PHP code example of cals / rsp

1. Go to this page and download the library: Download cals/rsp 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/ */

    

cals / rsp example snippets




namespace App\Repositories\Implementations;

use App\Models\Example;
use App\Repositories\Interfaces\ExampleRepositoryInterface;
use Cals\RSP\Repositories\Implementations\Repository;

class ExampleRepository extends Repository implements ExampleRepositoryInterface
{
    /**
     * Get the full name of model.
     *
     * @return mixed
     */
    function model()
    {
        return Example::class;
    }

    // Put your code here...
}




namespace App\Repositories\Interfaces;

interface ExampleRepositoryInterface
{
    // Put your code here...
}




namespace App\Services\Implementations;

use App\Repositories\Interfaces\ExampleRepositoryInterface;
use App\Services\Interfaces\ExampleServiceInterface;
use Cals\RSP\Services\Implementations\Service;

class ExampleService extends Service implements ExampleServiceInterface
{
    /**
     * ExampleService constructor.
     *
     * @param ExampleRepositoryInterface $repository
     */
    public function __construct(ExampleRepositoryInterface $repository)
    {
        $this->repository = $repository;
    }

    // Put your code here...
}




namespace App\Services\Interfaces;

interface ExampleServiceInterface
{
    // Put your code here...
}




namespace App\Presenters\Implementations;

use App\Presenters\Interfaces\ExamplePresenterInterface;
use Cals\RSP\Presenters\Implementations\Presenter;

class ExamplePresenter extends Presenter implements ExamplePresenterInterface
{
    // Put your code here...
}




namespace App\Presenters\Interfaces;

interface ExamplePresenterInterface
{
    // Put your code here...
}



/**
 * Created by PhpStorm.
 * User: Cals
 * Date: 2017/3/8
 * Time: 14:03
 */

return [

    /*
    |--------------------------------------------------------------------------
    | Repositories
    |--------------------------------------------------------------------------
    |
    | This array is the list of your repository. The key should be the full
    | name of interface and the value should be the full name of
    | implementation.
    */

    'repositories' => [],

    /*
    |--------------------------------------------------------------------------
    | Services
    |--------------------------------------------------------------------------
    |
    | This array is the list of your service. The key should be the full name
    | of interface and the value should be the full name of implementation.
    */

    'services' => [],

    /*
    |--------------------------------------------------------------------------
    | Presenters
    |--------------------------------------------------------------------------
    |
    | This array is the list of your presenter. The key should be the full name
    | of interface and the value should be the full name of implementation.
    */
    'presenters' => []
];

    'repositories' => [
        'App\Repositories\Interfaces\ExampleRepositoryInterface' => 'App\Repository\Implementations\ExampleRepository'
    ],