Add a line and example to the documentation covering the need to require the autoloader file in order to use autoloaded files
parent
943107cfe7
commit
26a2e94e78
|
@ -82,6 +82,8 @@ For any given event:
|
||||||
and command-line executable commands.
|
and command-line executable commands.
|
||||||
- PHP classes containing defined callbacks must be autoloadable via Composer's
|
- PHP classes containing defined callbacks must be autoloadable via Composer's
|
||||||
autoload functionality.
|
autoload functionality.
|
||||||
|
- If a defined callback relies on functions defined outside of a class, the callback
|
||||||
|
must explicitly require the composer autoloader.
|
||||||
|
|
||||||
Script definition example:
|
Script definition example:
|
||||||
|
|
||||||
|
@ -121,6 +123,14 @@ class MyClass
|
||||||
$composer = $event->getComposer();
|
$composer = $event->getComposer();
|
||||||
// do stuff
|
// do stuff
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function postAutoloadDump(Event $event)
|
||||||
|
{
|
||||||
|
$vendorDir = $event->getComposer()->getConfig()->get('vendor-dir');
|
||||||
|
require "$vendorDir/autoload.php";
|
||||||
|
|
||||||
|
some_function_from_an_autoloaded_file();
|
||||||
|
}
|
||||||
|
|
||||||
public static function postPackageInstall(PackageEvent $event)
|
public static function postPackageInstall(PackageEvent $event)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue