On the rare occasion you need to add a library of code that is not setup for Composer, then follow the X steps below:
- Download a library e.g Matex PHP Mathematical expression parser and evaluator
- Copy the library to a project root folder e.g
lib
- Add the path to the library code to your composer.json as follows:
"autoload": { "classmap": [ "database/seeds", "database/factories", "lib/matex/Matex" ], "psr-4": { "App\\": "app/" } },
- Now run
composer dump-autoload
- Add use command to your PHP class e.g.
use Matex\Evaluator;
Now you can use your library throughout your Laravel build.
Comments are closed.