1. Go to this page and download the library: Download avto-dev/roadrunner-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/ */
avto-dev / roadrunner-laravel example snippets
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\Http\Controllers\Controller;
class UserController extends Controller
{
/**
* The user repository instance.
*/
protected $users;
/**
* @var Request
*/
protected $request;
/**
* @param UserRepository $users
* @param Request $request
*/
public function __construct(UserRepository $users, Request $request)
{
$this->users = $users;
$this->request = $request;
}
/**
* @return Response
*/
public function store(): Response
{
$user = $this->users->getById($this->request->id);
// ...
}
}
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\Http\Controllers\Controller;
class UserController extends Controller
{
/**
* @param Request $request
* @param UserRepository $users
*
* @return Response
*/
public function store(Request $request, UserRepository $users): Response
{
$user = $users->getById($request->id);
// ...
}
}
use Illuminate\Http\Request;
use Illuminate\Session\Store;
class Middleware
{
/**
* @var Store
*/
protected $session;
/**
* @param Store $session
*/
public function __construct(Store $session)
{
$this->session = $session;
}
/**
* Handle an incoming request.
*
* @param Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$name = $this->session->getName();
// ...
return $next($request);
}
}
use Illuminate\Http\Request;
class Middleware
{
/**
* Handle an incoming request.
*
* @param Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$name = $request->session()->getName();
// $name = resolve('session')->getName();
// ...
return $next($request);
}
}