1. Go to this page and download the library: Download algoyounes/bindify 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/ */
algoyounes / bindify example snippets
namespace App\Contracts;
use AlgoYounes\Bindify\Attributes\BindWith;
use AlgoYounes\Bindify\Attributes\BindType;
use App\Services\DefaultService;
#[BindWith(DefaultService::class, BindType::Singleton)]
interface ServiceContract
{
public function execute();
}
namespace App\Services;
use App\Contracts\ServiceContract;
class DefaultService implements ServiceContract
{
public function execute()
{
// Your implementation
}
}
namespace App\Contracts;
use AlgoYounes\Bindify\Attributes\BindWith;
use AlgoYounes\Bindify\Attributes\BindType;
#[BindWith([DefaultService::class, AlternativeService::class], BindType::Singleton)]
interface ServiceContract
{
// ...
}