1. Go to this page and download the library: Download ray/ray-di-for-laravel 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/ */
ray / ray-di-for-laravel example snippets
namespace App\Http\Controllers;
use Ray\RayDiForLaravel\Attribute\Injectable;
#[Injectable]
class HelloController extends Controller
{
}
namespace App\Http\Controllers;
// no attributes
class MyController extends Controller
{
}
use Tests\TestCase;
final class HelloTest extends TestCase
{
use Ray\RayDiForLaravel\Testing\OverrideModule;
public function testStatusOk(): void
{
$this->overrideModule(new MyModule());
$res = $this->get('/hello');
$res->assertOk();
$res->assertSeeText('Hello 1 * 2 = 2.');
}
}