PHP code example of onepix / psr11-container-interface-generic

1. Go to this page and download the library: Download onepix/psr11-container-interface-generic 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/ */

    

onepix / psr11-container-interface-generic example snippets


final class App 
{
     /**
     * @param  ContainerInterface<Controller>  $controllers
     */
    public function __construct(
        private ContainerInterface $controllers,
    ) {
    }
}

/**
 * @implements ContainerInterface<Controller>
 */
final class ControllerContainer implements ContainerInterface
{
    public function get(string $id) {}

    public function has(string $id): bool {}
}
xml
<stubs>
    <file name="vendor/onepix/psr11-container-interface-generic/ContainerInterface.php"/>
</stubs>