Packages are available to simplify the integration of some functionality in project without fastidious configuration.
They are also the specificity to be able to used instead of middleware with implementation of PSR-15.
Installation of a package
If the package respect our recommendations, the installation is automatic ; but you can also declare package manually.
Manual installation of a package
-
Use composer to install package:
composer require berlioz/my-package
-
If you have a
packages.json
file in your configuration directory, go to 4. Else, create a file namedpackages.json
in your configuration directory and add the default content:{ "packages": [] }
-
Add package to the
packages.json
file of your project, looks like:{ "packages": [ "Berlioz\\Package\\MyPackage\\ClassOfMyPackage" ] }
-
Finished!