1. Go to this page and download the library: Download highperapp/container 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/ */
highperapp / container example snippets
// In any PHP project
use HighPerApp\HighPer\Container\Container;
$container = new Container();
$container->bind(DatabaseInterface::class, MySQLDatabase::class);
$database = $container->get(DatabaseInterface::class);
class UserService
{
public function __construct(
private DatabaseInterface $database,
private LoggerInterface $logger
) {}
}
// Register dependencies
$container->bind(DatabaseInterface::class, MySQLDatabase::class);
$container->bind(LoggerInterface::class, FileLogger::class);
// Auto-wire UserService
$userService = $container->get(UserService::class);
// Get memory usage statistics
$stats = $container->getStats();
// Object pool statistics
$poolStats = $stats['object_pool_stats'];
use HighPerApp\HighPer\Container\ObjectPool;
$container = new Container();
// Access and use object pool
$objectPool = new ObjectPool();
$objectPool->populate(ExpensiveObject::class, 10);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.