PHP code example of petrelli / live-statics

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

    

petrelli / live-statics example snippets


'providers' => [
    //...
    Petrelli\LiveStatics\BaseServiceProvider::class,
    //...
]

'mocked_classes' => [
    \App\Interfaces\ProjectInterface::class => [
        \App\Mocks\ProjectMock::class, \App\Project::class
    ],
],

use App\Interfaces\ProjectInterface;

class Project extends Model implements ProjectInterface
{
    #...
}

use \App\Interfaces\ProjectInterface;

class Controller extends BaseController
{
    public function index(ProjectInterface $model)
    {
        # Use your Project instance as normal
        # $model->all();
        # $model->published()->get();
    }
}


use \App\Interfaces\ProjectInterface;


class Controller extends BaseController
{
    public function index()
    {
        $model = app(ProjectInterface:class);

        # Use your Project instance as normal
        # $model->all();
        # $model->published()->get();
    }
}


'mocked_models' => [
    'Project',
]

php artisan vendor:publish --provider="Petrelli\LiveStatics\BaseServiceProvider"
bash
php artisan live-statics:class Project
bash
php artisan live-statics:model Project