PHP code example of zhwei / laravel-autowire
1. Go to this page and download the library: Download zhwei/laravel-autowire 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/ */
zhwei / laravel-autowire example snippets
$app->register(\Zhwei\LaravelAutowire\AutowireServiceProvider::class);
class HelloController implements Zhwei\LaravelAutowire\AutowireAble
{
/**
* @autowire
* @var \Illuminate\Contracts\Cache\Factory
*/
protected $cache;
public function hello()
{
return $this->cache->store()->get('hello');
}
}
$hello = new HelloController();
Zhwei\LaravelAutowire\AutowireInjector::inject(app(), $hello);