PHP code example of myerscode / laravel-sub-request

1. Go to this page and download the library: Download myerscode/laravel-sub-request 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/ */

    

myerscode / laravel-sub-request example snippets


namespace App\Controllers;

class MyController {
    
    public function __contstruct(Dispatcher $subRequest) {
        $this->subRequest = $subRequest;
    }
    
    public function routeOne() {
        return $this->subRequest->dispatch('POST', '/auth', ['foo' => 'bar'])
    }
    
    public function routeTwo() {
        return SubRequest::dispatch('GET', '/details', ['foo' => 'bar'])
    }
    
    public function routeThree() {
        return subrequest('GET', '/details', ['foo' => 'bar'])
    }
...
}