- First steps
- Installers
- Plugins
Use Composer with GorillaJS
August 4, 2017
Prerequisitos
You must have a gorilla.com user.- You must have got installed Docker, GorillaJS and Composer & PEAR plugin.
Installation
$ gorilla plugin add composer_and_pear
To uninstall:
$ gorilla plugin remove composer_and_pear
How to use it
This plugin is used in the same way you could use Composer, PEAR or PECL. The only difference is that you’ll have to put ahead “gorilla” of any command.
To install a Composer library:
$ gorilla composer require your/library
To uninstall it:
$ gorilla composer remove your/library
To install a PECL package:
$ gorilla pecl install your-package
In this example we are installing a “not stable” library passing the -f parameter. You’ll find more information here.
$ gorilla pear install -f your-package
If you use Composer, GorillaJS will save the library in the published root of your project. If you use PECL or PEAR, at the end of the installation, GorillaJS will create a new version of the Docker container of your project. So you won’t lose your changes or you won’t have to install libraries again the next time you start your project. You can see the available packages and libraries in the official installers lists: Composer, PEAR and PECL. Some PEAR and PECL packages like Imagick have dependences you have to install using a different package manager, like apt in Ubuntu or apk in Alpine Linux. You can use for example the Extra packages plugin. Installing the Imagick would be very simple:
First you would have to install the original C++ libraries:
$ gorilla apk add imagemagick imagemagick-dev
Later the PECL package:
$ gorilla pecl install imagick
The NodeJS installer
The NodeJS template that comes as a default in GorillaJS uses the Express.js framework to start a server and return a response. This is optional, and once the application is running we can eliminate this server and use the application in any other way.
FAQ’s
Why do you need to free the port 80? Can you make your own installers? Can you use GorillaJS in a remote server?