1. Go to this page and download the library: Download selami/stdlib 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/ */
selami / stdlib example snippets
declare(strict_types=1);
use Selami\Stdlib\EqualsBuilder;
class SomeValueObject()
{
private $value1;
private $value2;
public function __construct(string $value1, string $value2)
{
$this->value1 = $value1;
$this->value2 = $value2;
}
public function getValue1() :string
{
return $value1;
}
public function getValue2() : string
{
return $value2;
}
public function equals($otherObject) : bool
{
return EqualsBuilder::create()
->append($this->value1, $otherObject->getValue1())
->append($this->value2, $otherObject->getValue2())
->isEquals();
}
}
declare(strict_types=1);
use Selami\Stdlib\Resolver;
class BlogService {}
class Controller
{
private $argument;
private $service;
public function __construct(BlogService $service, array $argument)
{
$this->service = $service;
$this->argument = $argument;
}
}
$arguments = Resolver::getParameterHints(Controller::class, '__construct');
var_dump($arguments);
/* Prints
array(2) {
["service"]=>
string(11) "BlogService"
["argument"]=>
string(5) "array"
}
*/