PHP code example of oltrematica / laravel-fake-parking

1. Go to this page and download the library: Download oltrematica/laravel-fake-parking 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/ */

    

oltrematica / laravel-fake-parking example snippets


'fake' => [
    'class' => \Oltrematica\FakeParking\Support\FakeParkingValidator::class,
],

'fake' => [
    'class' => \Oltrematica\FakeParking\Support\FakeParkingValidator::class,
    'probabilities' => ['green' => 65, 'red' => 20, 'fuchsia' => 3],
    'deterministic' => true,
    'duration'      => ['min' => 30, 'max' => 180],
],

> 'fake' => array_merge(
>     ['class' => \Oltrematica\FakeParking\Support\FakeParkingValidator::class],
>     config('fake-parking'),
> ),
> 

use Oltrematica\ParkingHub\Facades\ParkingHub;
use Carbon\Carbon;

$response = ParkingHub::driver('fake')->checkPlate('AA123BB', Carbon::now());

$response->responseStatus;   // sempre ProviderInteractionStatus::SUCCESS_OK
$response->isValid;          // true solo per l'esito "verde"
$response->parkingEndTime;   // fine del parcheggio fabbricato
$response->purchasedParkings; // 1 elemento (start/end del parcheggio)
bash
php artisan vendor:publish --tag=fake-parking-config