Start a conversation

How to use scriptcase with composer

Getting composer.phar

To quickly install Composer in the current directory, run the following script in your terminal.

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

The output should be:

The file composer.phar will be located in your folder.

Writing the composer.json file

You must write the name, description and the dependencies you would like to use.


{    
     "name": "vendor/name",    
     "description": "description",                                  "require": {
        "dompdf/dompdf": "version"
     }
}

Updating the dependencies

You must write the code bellow in the terminal to update the composer file.

php composer.phar update

After that you must compress the files to upload inside your external library.

Creating a new library

Inside the tools option you have to go into external libraries and click "create new library".

You must click the option use library to get it working in the project, after that you can edit it to upload your files.

Select the zip file to upload your dependencies.

After that your files will be available inside your external library.

Using dompdf in your application

You must add an sc_include_library to your external library and use the dependencie's correct namespace.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Lucas Silva

  2. Posted
  3. Updated

Comments