PHP code example of dispify / weaver
1. Go to this page and download the library: Download dispify/weaver 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/ */
dispify / weaver example snippets
class A {}
class B {
public function __construct(A $a) {}
}
$weaver = new \Dispify\Weaver\Weaver();
$weaver->weave(B::class, $arguments = []); // register dependency
$weaver->get(B::class); // instantiate and return object of B. The service of A is created via autowiring