PHP code example of venoudev / results

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

    

venoudev / results example snippets


  /**
  * Venoudev Results
  */
  $app->register(Venoudev\Results\Providers\LumenResultsServiceProvider::class);
  

    php artisan vendor:publish --tag=results-resources
  

    php artisan config:clear
  

   
    $facades = [
        '\Venoudev\Results\Facades\ResultManagerFacade' =>  'ResultManager',
        'Illuminate\Support\Facades\App' => 'App'
    ];

    $app->withFacades(true ,$facades);
    $app->withEloquent();

   
  

    php artisan make:validator Example
  

      

      namespace App\Validators;

      use Illuminate\Support\Facades\Validator;
      use Venoudev\Results\Exceptions\CheckDataException;

      class ExampleValidator
      {

          public static function execute($data){

              $validator=Validator::make($data,[
                   // Your awesome laravel validations here
              ]);

              if ($validator->fails()) {
                  $exception = new CheckDataException();
                  $exception->addFieldErrors($validator->errors());
                  throw $exception;
              }
              return;
          }
      }
  

    php artisan make:action Example
  

      

      namespace App\Actions;

      class ExampleAction
      {

          public static function execute($data){
            // Your awesome code here.
            return;
          }
      }
  

    php artisan make:service Example
  

      

      namespace App\Services\Contracts;

      interface ExampleService {
           // Your awesome methods to implement here.
      }