-
Notifications
You must be signed in to change notification settings - Fork 399
Autoloading
Bob Gobeille edited this page Apr 23, 2015
·
1 revision
After the introduction of Composer the configuration of PSR-4 style autoloading is quite simple. Here are some links to provide background:
Autoloading helps to avoid management of require statements to load depending classes. It can be configured by adding Namespace -> Path mapping to the file composer.json.
Each call of composer install/update creates or updates the autoloading configuration.
Content of composer.json:
{
...
"autoload": {
"psr-4": {"Fossology\\Lib\\": "lib/php"}
}
}
If you have a class on the path lib/php/Foo/Bar.php
<?php
namespace Fossology\Lib\Foo;
class Bar
{
}
you can now instatiate an object of type Bar everywhere just by using
$bar = new \Fossology\Lib\Foo\Bar();
The autoloader takes care of reading the file Bar.php once to ensure a defined class Bar.
Just include the autoloader initialization file
src/vendor/autoload.php
Currently this is done in src/lib/php/common.php.
- Nomos
- Monk
- MonkBulk
- ReSo-(REUSE.Software)
- Reuse clearing with reuser
- ScanCode agent
- Copyright
- ECC
- Package Agent
- Maintenance Agent
- Mimetype Agent
- Buckets
- Spasht Agent
- Email notification configuration
- Migration to UTF 8 DB
- External authentication configuration
- OpenID Connect authentication configuration
- Access Control