PHP code example of richan-fongdasen / firestore-laravel

1. Go to this page and download the library: Download richan-fongdasen/firestore-laravel 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/ */

    

richan-fongdasen / firestore-laravel example snippets


return [
    'project_id'  => env('GOOGLE_CLOUD_PROJECT'),
    'credentials' => env('GOOGLE_APPLICATION_CREDENTIALS'),
    'database'    => env('FIRESTORE_DATABASE', '(default)'),

    'cache' => [
        'collection'           => env('FIRESTORE_CACHE_COLLECTION', 'cache'),
        'key_attribute'        => env('FIRESTORE_CACHE_KEY_ATTR', 'key'),
        'value_attribute'      => env('FIRESTORE_CACHE_VALUE_ATTR', 'value'),
        'expiration_attribute' => env('FIRESTORE_CACHE_EXPIRATION_ATTR', 'expired_at'),
    ],

    'session' => [
        'collection' => env('FIRESTORE_SESSION_COLLECTION', 'sessions'),
    ],
];

'stores' => [
    'firestore' => [
        'driver' => 'firestore',
    ],
],

// Cache store
Cache::put('key', 'value', 60); // Store a value in the cache for 60 seconds

$value = Cache::get('key'); // Retrieve a value from the cache

// Session
session(['key' => 'value']); // Store a value in the session

$value = session('key'); // Retrieve a value from the session
bash
php artisan vendor:publish --tag="firestore-laravel-config"