PHP code example of pine3ree / pine3ree-auto-resolving-factory
1. Go to this page and download the library: Download pine3ree/pine3ree-auto-resolving-factory 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/ */
pine3ree / pine3ree-auto-resolving-factory example snippets
// file: src/My/App/Model/PostMapper.php
use My\App\Database\DbInterface;
use My\App\Database\Db\HydratorInterface;
use My\App\Configuration\Config;
class PostMapper
{
//...
public function __construct(DbInterface $db, HydratorInterface $hydrator)
{
// ... inject deps here
}
}
/// ---
// file: test.php
use My\App\Model\PostMapper;
use Psr\Container\ContainerInterface;
use pine3ree\Container\Factory\AutoResolvingFactory;
$container =
$postMapper = $container->get(PostMapper::class);