Topics

Anahita Project

Anahita Project's Topics

Rastin Mehr

Rastin Mehr

August 28 2017

Using Composer to install apps

I am going through composer docs and also how other php projects are using Composer to manage their extensions. We can indeed use composer to move files by configuration the install paths:https://getcomposer.org/doc/faqs/how-do-i-install-a-package-to-a-custom-path-for-my-framework.md#how-do-i-install-a-package-to-a-custom-path-for-my-framework-This way we don't have to create a www folder of symlinks and use actual files. I am interested in distributing Anahita apps on separated repositories so we can install and uninstall them using composer. Also developing a blueprint for 3rd party developers to develop and distribute Anahita apps using packagist and composer. Developers will be able to distribute apps directly from their github repos.#PHPComposer #Packagist #AppManagement #Installation  
Rastin Mehr
Rastin Mehr
August 28 2017 Permalink
And here are the Composer script events which allow us to call custom php methods before and after Composer install and update https://getcomposer.org/doc/articles/scripts.md

Here is a general idea:

INSTALL: Composer Install downloads and moves the files where they need to be and then calls a php method that creates a database schema and recreates javascript bundles

UNINSTALL: Composer Uninstall first calls a php method to cleanup the schema and app's data, then removes the files, then recreates the javascript bundles.

We still need to figure out a good design pattern in the React and Redux for extending and abbreviating the javascript codebase. This is so the client side would work as a single page app.
Rastin Mehr
Rastin Mehr
August 28 2017 Permalink
We can also continue using symlinks. Creating symlinks is much quicker than file copying and that's a plus. So far using symlinks for Anahita has been quite reliable.
Rastin Mehr
Rastin Mehr
August 28 2017 Permalink
Also it would be great we get Docker images for Anahita https://www.docker.com This way you can easily develop Anahita and deploy to your server. Their community edition is free. I'm also quite impressed with the Joomla vagrant box from Joomlatools https://github.com/joomlatools/joomlatools-vagrant
Nick Swinford
Nick Swinford
August 28 2017 Permalink
I think it'd be nice if we started using the composer autoloader for dependencies like apps instead of moving everything around and symlinking. If we could make Anahita's autoloader compatible (I think it is for the most part), that should be pretty easy to do.
Rastin Mehr
Rastin Mehr
August 28 2017 Permalink
I'm not sure how we can just use the autoloader, unless we somehow translate all the file paths. Do you know any existing platforms that use autoloader for the extensions too?
Nick Swinford
Nick Swinford
August 28 2017 Permalink
No, I don't know of any examples.

Why would the file paths need to be translated? The point of the autoloader is to find where the files are located automatically and include them, right? The only issue I'd see is with template files cause those aren't classes, but we'd just have to extend the template path.
Rastin Mehr
Rastin Mehr
August 28 2017 Permalink
That's something we need to research and look into. Right now I don't have any comments 🙂

Powered by Anahita