PHP code example of cosmicvelocity / lumen-helpers

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

    

cosmicvelocity / lumen-helpers example snippets


// Add alias('cookie', \Illuminate\Cookie\CookieJar::class);
$app->alias('cookie', \Illuminate\Contracts\Cookie\Factory::class);
$app->alias('cookie', \Illuminate\Contracts\Cookie\QueueingFactory::class);
$app->alias('session', \Illuminate\Session\SessionManager::class);
$app->alias('session.store', \Illuminate\Session\Store::class);
$app->alias('session.store', \Illuminate\Contracts\Session\Session::class);

// Read the configuration file.
// You need to prepare a configuration file similar to Laravel in config/session.php.
$app->configure('session');

$app->withFacades(true, [
    \Illuminate\Support\Facades\Config::class => 'Config'
]);

// Set cookie, Session service provider.
$app->register(\Illuminate\Cookie\CookieServiceProvider::class);
$app->register(\Illuminate\Session\SessionServiceProvider::class);

// Set middleware.
$app->middleware([
    \Illuminate\Cookie\Middleware\EncryptCookies::class,
    \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
    \Illuminate\Session\Middleware\StartSession::class,
    \Illuminate\View\Middleware\ShareErrorsFromSession::class,
]);

    return redirect_with_session(route('index'))
        ->withErrors($errors)
        ->withInput();
    

    // Define redirect first.
    function redirect($to = null, $status = 302, $headers = [], $secure = null) {
      return redirect_with_session($to, $status, $headers, $secure);
    }