PHP code example of switon / composer-extra

1. Go to this page and download the library: Download switon/composer-extra 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/ */

    

switon / composer-extra example snippets


use Switon\ComposerExtra\ComposerExtraInterface;
use Switon\Core\Attribute\Autowired;

final class PackageRegistry
{
    #[Autowired] protected ComposerExtraInterface $composerExtra;

    public function listeners(): array
    {
        return $this->composerExtra->collect('switon.listeners');
    }

    public function cacheHealth(): array
    {
        return $this->composerExtra->health();
    }
}