PHP code example of beholdr / laravel-helpers

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

    

beholdr / laravel-helpers example snippets


return [
    'http_client_log' => true,
];

return Application::configure(basePath: dirname(__DIR__))
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->alias([
            // other middleware aliases...
            'redirect' => \Beholdr\LaravelHelpers\Middleware\Redirect::class,
        ]);



use function Laravel\Folio\middleware;

// redirect by route name
middleware(['redirect:route.cards.unistream']);

// OR redirect by URL
middleware(['redirect:/']);


return Application::configure(basePath: dirname(__DIR__))
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->web(append: [
            \Beholdr\LaravelHelpers\Middleware\PermanentRedirects::class,
        ]);

return Application::configure(basePath: dirname(__DIR__))
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->web(append: [
            \Beholdr\LaravelHelpers\Middleware\RemoveIndex::class,
        ]);

return Application::configure(basePath: dirname(__DIR__))
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->web(append: [
            \Beholdr\LaravelHelpers\Middleware\RemoveTrailingSlash::class,
        ]);

use Beholdr\LaravelHelpers\Enums\UtmFields;

UtmFields::fromQuery(request()->getQueryString()); // ['utm_content' => '...', 'utm_source' => '...']

'channels' => [
    // other channels...
    'telegram' => [
        'driver' => 'custom',
        'via' => \Beholdr\LaravelHelpers\Logging\TelegramLogChannel::class,
        'token' => env('TELEGRAM_BOT_TOKEN'),
        'channel' => env('TELEGRAM_CHAT_ID'),
        'level' => env('TELEGRAM_LOG_LEVEL', \Monolog\Level::Error),
    ],
]
bash
php artisan vendor:publish --tag="helpers-config"