PHP code example of pfaciana / composer-autoloader-plugin
1. Go to this page and download the library: Download pfaciana/composer-autoloader-plugin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pfaciana / composer-autoloader-plugin example snippets
namespace App;
use Render\Autoloader\Attributes\AutoRun;
#[AutoRun(priority: 10)]
function bootstrap(): void
{
// Runs when vendor/autoload.php is loaded.
}
namespace App;
use Render\Autoloader\Attributes\AutoRun;
class Plugin
{
#[AutoRun(priority: 20)]
public static function boot(): void
{
// Static methods are supported.
}
}
use Render\Autoloader\Attributes\AutoRun;
#[AutoRun(import: '
\bootstrap();
use Render\Autoloader\Attributes\AutoRun;
class Plugin
{
#[AutoRun]
public static function boot(): void
{
}
}
use Render\Autoloader\Attributes\AutoRun;
#[AutoRun(check: true)]
function bootstrap(): void
{
}
#[AutoRun(check: true)]
function register_helpers(): void
{
}
if (array_filter(['bootstrap', 'register_helpers'], fn($f) => !function_exists($f))) {
namespace App;
#[Bootstrap(priority: 10)]
function bootstrap(): void
{
}
use Render\Autoloader\Attributes\AutoRun as Run;
#[Run]
function bootstrap(): void
{
}
class Plugin
{
#[AutoRun(priority: self::BOOT_PRIORITY)]
public static function boot(): void
{
}
}
// src/functions.php
function app_helper(): string
{
return 'ready';
}
#[AutoRun(priority: 10)]
#[Other]
function bootstrap(): void
{
}
#[Other, AutoRun(priority: 10)]
function bootstrap(): void
{
}
bash
composer dump-autoload
text
**/*.php
!vendor
!node_modules
!src/Excluded
text
vendor/composer/autoload_bootstrap.php
text
vendor/composer/autoload_directory_files.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.