Keeping Your Laravel Forms Awake.

Overview

Caffeine for Laravel

Travis Scrutinizer Coveralls GitHub (pre-)release Packagist

Caffeine for Laravel masthead image.

Supporting This Package

This is an MIT-licensed open source project with its ongoing development made possible by the support of the community. If you'd like to support this, and our other packages, please consider becoming a sponsor.

Goal

Prevent forms from timing out when submitting them after leaving them on-screen for a considerable amount of time. (Laravel defaults to 120 minutes, but that is configurable and could be different site-by-site.)

Implementation

To achieve this, we are sending a caffeine-drip (a request at regular intervals) to keep the session from timing out. This is only implemented on pages with a _token field, so all other pages will time-out as normal.

Reasoning

I chose this approach to keep the integrity of site-security, by avoiding the following:

  • exposing the CSRF Token on an unsecured endpoint.
  • eliminating CSRF Token validation on specific routes, or even altogether.
  • removing session-timeout on all pages.

Considerations

Incompatible Packages

  • Voyager has been reported as being incompatible. To work around this, configure Caffeine to use route-based middleware on all non-Voyager routes. See details below for configuration and implementation of route-based middleware.

Routes

This package adds the routes under genealabs/laravel-caffeine.

Dependencies

Your project must fullfill the following:

  • Laravel 8.0 or higher
  • PHP 7.3 or higher.

Installation

composer require genealabs/laravel-caffeine

Upgrade Notes

If you have previously registered the middleware, please remove the following middleware from app/Http/Kernel.php:

// protected $middleware = [
    GeneaLabs\LaravelCaffeine\Http\Middleware\LaravelCaffeineDripMiddleware::class,
// ];

0.6.0

This update changes the config file setting names. Please delete the published config file config/genealabs-laravel-caffeine.php if it exists, and follow the configuration instructions below.

Configuration

300000, /* |-------------------------------------------------------------------------- | Domain |-------------------------------------------------------------------------- | | You may optionally configure a separate domain that you are running | Caffeine for Laravel on. This may be of interest if you have a | monitoring service that queries other apps. Setting this to | null will use the domain of the current application. | | Default: null (null|string) | */ 'domain' => null, /* |-------------------------------------------------------------------------- | Drip Endpoint URL |-------------------------------------------------------------------------- | | Sometimes you may wish to white-label your app and not expose the AJAX | request URLs as belonging to this package. To achieve that you can | rename the URL used for dripping caffeine into your application. | | Default: 'genealabs/laravel-caffeine/drip' (string) | */ 'route' => 'genealabs/laravel-caffeine/drip', // Customizable end-point URL /* |-------------------------------------------------------------------------- | Checking for Lapsed Drips |-------------------------------------------------------------------------- | | If the browser is put to sleep on (for example on mobile devices or | laptops), it will still cause an error when trying to submit the | form. To avoid this, we force-reload the form 2 minutes prior | to session time-out or later. Setting this setting to 0 | will disable this check if you don't want to use it. | | Default: 2000 (int) | */ 'outdated-drip-check-interval' => 2000, /* |-------------------------------------------------------------------------- | Use Route Middleware |-------------------------------------------------------------------------- | | Drips are enabled via route middleware instead of global middleware. | | Default: false (bool) | */ 'use-route-middleware' => false, ]; ">
return [
    /*
    |--------------------------------------------------------------------------
    | Drip Interval
    |--------------------------------------------------------------------------
    |
    | Here you may configure the interval with which Caffeine for Laravel
    | keeps the session alive. By default this is 5 minutes (expressed
    | in milliseconds). This needs to be shorter than your session
    | lifetime value configured set in "config/session.php".
    |
    | Default: 300000 (int)
    |
    */
    'drip-interval' => 300000,

    /*
    |--------------------------------------------------------------------------
    | Domain
    |--------------------------------------------------------------------------
    |
    | You may optionally configure a separate domain that you are running
    | Caffeine for Laravel on. This may be of interest if you have a
    | monitoring service that queries other apps. Setting this to
    | null will use the domain of the current application.
    |
    | Default: null (null|string)
    |
    */
    'domain' => null,

    /*
    |--------------------------------------------------------------------------
    | Drip Endpoint URL
    |--------------------------------------------------------------------------
    |
    | Sometimes you may wish to white-label your app and not expose the AJAX
    | request URLs as belonging to this package. To achieve that you can
    | rename the URL used for dripping caffeine into your application.
    |
    | Default: 'genealabs/laravel-caffeine/drip' (string)
    |
    */
    'route' => 'genealabs/laravel-caffeine/drip', // Customizable end-point URL

    /*
    |--------------------------------------------------------------------------
    | Checking for Lapsed Drips
    |--------------------------------------------------------------------------
    |
    | If the browser is put to sleep on (for example on mobile devices or
    | laptops), it will still cause an error when trying to submit the
    | form. To avoid this, we force-reload the form 2 minutes prior
    | to session time-out or later. Setting this setting to 0
    | will disable this check if you don't want to use it.
    |
    | Default: 2000 (int)
    |
    */
    'outdated-drip-check-interval' => 2000,

    /*
    |--------------------------------------------------------------------------
    | Use Route Middleware
    |--------------------------------------------------------------------------
    |
    | Drips are enabled via route middleware instead of global middleware.
    |
    | Default: false (bool)
    |
    */
    'use-route-middleware' => false,

];

Only publish the config file if you need to customize it:

php artisan caffeine:publish --config

Usage

That was it! It will apply itself automatically where it finds a form with a _token field, or a meta tag named "csrf-token", while pages are open in browsers.

Prevent Caffeination

There are two methods to prevent Caffeine for Laravel from dripping to keep the session alive: disabling it in Blade using the meta tag method, or enabling route-middleware mode, and then only enabling it on routes or route groups.

Meta Tag Method

If you would like to prevent a certain page from caffeinating your application, then add the following meta tag:

">
  "caffeinated" content="false">

Route Middleware Method

To enable this mode, you need to publish the configuration file (see the configuration section above) and then set use-route-middleware to true. This will disable the default global middleware mode (which applies it to any page that has the CSRF token in it across your entire application). Now you need to selectively enable Caffeine on a given route or route group using route middleware:

Route::any('test', 'TestController@test')->middleware('caffeinated');

Route::group(['middleware' => ['caffeinated']], function () {
    Route::any('test', 'TestController@test');
})

You can still use the route middleware method and apply it globally to all routes by editing app/Http/Kernel.php and adding it to the web middleware group. Although you should only use this option if you have a very specific use- case that prevents you from utilizing the default global middleware option.

This will only have effect if the page includes a form. If not, the page will not caffeinate your application anyway.

The Fine Print

Commitment to Quality

During package development I try as best as possible to embrace good design and development practices to try to ensure that this package is as good as it can be. My checklist for package development includes:

  • Achieve as close to 100% code coverage as possible using unit tests.
  • Eliminate any issues identified by SensioLabs Insight and Scrutinizer.
  • Be fully PSR1, PSR2, and PSR4 compliant.
  • Include comprehensive documentation in README.md.
  • Provide an up-to-date CHANGELOG.md which adheres to the format outlined at https://keepachangelog.com.
  • Have no PHPMD or PHPCS warnings throughout all code.

Contributing

Please observe and respect all aspects of the included Code of Conduct https://github.com/GeneaLabs/laravel-caffeine/blob/master/CODE_OF_CONDUCT.md.

Reporting Issues

When reporting issues, please fill out the included template as completely as possible. Incomplete issues may be ignored or closed if there is not enough information included to be actionable.

Submitting Pull Requests

Please review the Contribution Guidelines https://github.com/GeneaLabs/laravel-caffeine/blob/master/CONTRIBUTING.md. Only PRs that meet all criterium will be accepted.

❤️ Open-Source Software - Give ⭐️

We have included the awesome symfony/thanks composer package as a dev dependency. Let your OS package maintainers know you appreciate them by starring the packages you use. Simply run composer thanks after installing this package. (And not to worry, since it's a dev-dependency it won't be installed in your live environment.)

Comments
  • Problems with the installation

    Problems with the installation

    working with laravel 5.2.45

    installed via composer require genealabs/laravel-caffeine:~0.3.11

    inserted in the config/app file

    GeneaLabs\LaravelCaffeine\Providers\LaravelCaffeineService::class,

    but laravel throws

    Class 'GeneaLabs\LaravelCaffeine\Providers\LaravelCaffeineService' not found

    error.

    g patrick

    enhancement high priority 
    opened by patpaskoch 24
  • not working for X-CSRF-TOKEN request header

    not working for X-CSRF-TOKEN request header

    Hi,

    does this package also work for ajax request? its currently not working for me. i know it says it works for any page has _token, is ajax request included?

    i did as laravel doc suggests:

    <meta name="csrf-token" content="{{ csrf_token() }}">
    
    $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
    });
    

    update: i checked LaravelCafineDripMiddleware.php, and outputed $content. it turns out that the response content from my server is array instead of string since its not returning a view file. also it seems that the middleware is called twice. the first one returns content as string, the second one returns array.

    opened by shangsunset 24
  • All my forms still expire

    All my forms still expire

    I have set my 'drip-interval' => 59000 and my sessions 'lifetime' => env('SESSION_LIFETIME', 1), but my form still expires. I have a search box on every page.

    How can I properly test this. I am not that experienced with phpunit so I do not know how to test using your tests.

    Expected Behavior

    Not expire

    Acutal Behavior

    Expire

    Environment

    • PHP Version: 7.1
    • Laravel Version: 5.5
    • LaravelCaffeine Version:0.6.2

    Stack Trace

    No stack trace. I don't know how to debug this

    unconfirmed bug 
    opened by warmwhisky 22
  • Forms still expire

    Forms still expire

    Expected Behavior

    Forms stills alive

    Actual Behavior

    They expire

    Details

    Using the middleware method, all the drips get 204, no problem so far. The only thing I noted is that after the session time expiration, the XSRF-TOKEN cookie being sent for the drip disappears.

    It seems that Laravel doesn't want to maintain the token session alive in the form even if the drips are correctly sent and responded.

    Already removed and reinstalled Caffeine and dumped the autoload juts to be sure.

    Workaround

    ~~Using Axios, I made a normal get to the form located axios.get('https://myapp.test/login and the token lives throught the timeout . But using axios to the default dripping route doesn't.~~

    ~~It would seem that Laravel session enforces the current URL, but after using get on other routes of the application (like axios.get('https://myapp.test/artist/michael-jackson/albums/all')) also keep them alive.~~

    See updates.

    Environment

    • PHP Version: 7.2.4
    • NGINX: 1.12.2
    • Laravel Version: 5.6
    • LaravelCaffeine Version: 0.6.8

    Stack Trace

    Unavailable.

    bug 
    opened by ItaloBC 21
  • All Views are rendered twice

    All Views are rendered twice

    This is because calling $content->render(); in LaravelCaffeineDripMiddleware.php on line 28. I noticed this behaviour because in one of my Views I use Session::pull(). The data are pulled during the first rendering and of course no longer available when the View is rendered the second time (and delivered to the client).

    Any suggestions to avoid this?

    low priority unconfirmed bug 
    opened by lbausch 18
  • Still getting TokenMismatchException after Laravel session lifetime

    Still getting TokenMismatchException after Laravel session lifetime

    Hi

    When I leave a form open for a while, I still get a TokenMismatchException. I'm using Laravel 5.2.

    For testing I've set the session lifetime in config/session.php to 3 minutes and the drip interval to 1 min (60000ms). The drip route is being called every minute as it should (no errors in the Chrome network tab).

    After the first drip I can still send the form, but after 3 drips or minutes I get the Token exception.

    TokenMismatchException in VerifyCsrfToken.php line 67:
    

    Seems the session isn't actually being refreshed?

    opened by ivanvermeyen 15
  • Causes PHPUnit errors - Cannot redeclare hasWebMiddleware()

    Causes PHPUnit errors - Cannot redeclare hasWebMiddleware()

    With the package installed I get the following errors when I run vendor/bin/phpunit in my Laravel v5.2.20 app:

    .PHP Fatal error:  Cannot redeclare hasWebMiddleware() (previously declared in /home/vagrant/Code/MyProject/vendor/genealabs/laravel-caffeine/src/Http/routes.php:13) in /home/vagrant/Code/MyProject/vendor/genealabs/laravel-caffeine/src/Http/routes.php on line 28
    PHP Stack trace:
    PHP   1. {main}() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:0
    PHP   2. PHPUnit_TextUI_Command::main() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:47
    PHP   3. PHPUnit_TextUI_Command->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:100
    PHP   4. PHPUnit_TextUI_TestRunner->doRun() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:149
    PHP   5. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
    PHP   6. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
    PHP   7. PHPUnit_Framework_TestCase->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
    PHP   8. PHPUnit_Framework_TestResult->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
    PHP   9. PHPUnit_Framework_TestCase->runBare() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
    PHP  10. Illuminate\Foundation\Testing\TestCase->setUp() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:764
    PHP  11. Illuminate\Foundation\Testing\TestCase->refreshApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:64
    PHP  12. TestCase->createApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:85
    PHP  13. Illuminate\Foundation\Console\Kernel->bootstrap() /home/vagrant/Code/MyProject/tests/TestCase.php:23
    PHP  14. Illuminate\Foundation\Application->bootstrapWith() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
    PHP  15. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
    PHP  16. Illuminate\Foundation\Application->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
    PHP  17. array_walk() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
    PHP  18. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
    PHP  19. Illuminate\Foundation\Application->bootProvider() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
    PHP  20. Illuminate\Container\Container->call() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
    PHP  21. call_user_func_array:{/home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
    PHP  22. GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
    PHP Fatal error:  Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:752
    Stack trace:
    #0 /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Container\Container->build('Illuminate\\Cont...', Array)
    #1 /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
    #2 /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(154): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
    #3 /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(79): Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler()
    #4 /home/vagrant/Code/Health in /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 752
    PHP Stack trace:
    PHP   1. {main}() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:0
    PHP   2. PHPUnit_TextUI_Command::main() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:47
    PHP   3. PHPUnit_TextUI_Command->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:100
    PHP   4. PHPUnit_TextUI_TestRunner->doRun() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:149
    PHP   5. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
    PHP   6. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
    PHP   7. PHPUnit_Framework_TestCase->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
    PHP   8. PHPUnit_Framework_TestResult->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
    PHP   9. PHPUnit_Framework_TestCase->runBare() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
    PHP  10. Illuminate\Foundation\Testing\TestCase->setUp() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:764
    PHP  11. Illuminate\Foundation\Testing\TestCase->refreshApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:64
    PHP  12. TestCase->createApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:85
    PHP  13. Illuminate\Foundation\Console\Kernel->bootstrap() /home/vagrant/Code/MyProject/tests/TestCase.php:23
    PHP  14. Illuminate\Foundation\Application->bootstrapWith() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
    PHP  15. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
    PHP  16. Illuminate\Foundation\Application->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
    PHP  17. array_walk() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
    PHP  18. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
    PHP  19. Illuminate\Foundation\Application->bootProvider() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
    PHP  20. Illuminate\Container\Container->call() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
    PHP  21. call_user_func_array:{/home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
    PHP  22. GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
    
    Fatal error: Cannot redeclare hasWebMiddleware() (previously declared in /home/vagrant/Code/MyProject/vendor/genealabs/laravel-caffeine/src/Http/routes.php:13) in /home/vagrant/Code/MyProject/vendor/genealabs/laravel-caffeine/src/Http/routes.php on line 28
    
    Call Stack:
        0.0003     353920   1. {main}() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:0
        0.3202    1423064   2. PHPUnit_TextUI_Command::main() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:47
        0.3202    1423176   3. PHPUnit_TextUI_Command->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:100
        2.5127    4533856   4. PHPUnit_TextUI_TestRunner->doRun() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:149
        2.5826    4638848   5. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
        2.5843    4645296   6. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
        6.3418   13871320   7. PHPUnit_Framework_TestCase->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
        6.3418   13871320   8. PHPUnit_Framework_TestResult->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
        6.3418   13871320   9. PHPUnit_Framework_TestCase->runBare() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
        6.3419   13887848  10. Illuminate\Foundation\Testing\TestCase->setUp() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:764
        6.3419   13887848  11. Illuminate\Foundation\Testing\TestCase->refreshApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:64
        6.3419   13887848  12. TestCase->createApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:85
        6.3434   13907600  13. Illuminate\Foundation\Console\Kernel->bootstrap() /home/vagrant/Code/MyProject/tests/TestCase.php:23
        6.3434   13907600  14. Illuminate\Foundation\Application->bootstrapWith() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
        6.5850   14038056  15. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
        6.5850   14038056  16. Illuminate\Foundation\Application->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
        6.5850   14038400  17. array_walk() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
        6.6323   14114144  18. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
        6.6323   14114144  19. Illuminate\Foundation\Application->bootProvider() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
        6.6324   14114520  20. Illuminate\Container\Container->call() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
        6.6324   14114632  21. call_user_func_array:{/home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
        6.6324   14114696  22. GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
    
    
    Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 752
    
    Call Stack:
        0.0003     353920   1. {main}() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:0
        0.3202    1423064   2. PHPUnit_TextUI_Command::main() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:47
        0.3202    1423176   3. PHPUnit_TextUI_Command->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:100
        2.5127    4533856   4. PHPUnit_TextUI_TestRunner->doRun() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:149
        2.5826    4638848   5. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
        2.5843    4645296   6. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
        6.3418   13871320   7. PHPUnit_Framework_TestCase->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
        6.3418   13871320   8. PHPUnit_Framework_TestResult->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
        6.3418   13871320   9. PHPUnit_Framework_TestCase->runBare() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
        6.3419   13887848  10. Illuminate\Foundation\Testing\TestCase->setUp() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:764
        6.3419   13887848  11. Illuminate\Foundation\Testing\TestCase->refreshApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:64
        6.3419   13887848  12. TestCase->createApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:85
        6.3434   13907600  13. Illuminate\Foundation\Console\Kernel->bootstrap() /home/vagrant/Code/MyProject/tests/TestCase.php:23
        6.3434   13907600  14. Illuminate\Foundation\Application->bootstrapWith() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
        6.5850   14038056  15. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
        6.5850   14038056  16. Illuminate\Foundation\Application->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
        6.5850   14038400  17. array_walk() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
        6.6323   14114144  18. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
        6.6323   14114144  19. Illuminate\Foundation\Application->bootProvider() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
        6.6324   14114520  20. Illuminate\Container\Container->call() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
        6.6324   14114632  21. call_user_func_array:{/home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
        6.6324   14114696  22. GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
    
    Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 752
    
    Call Stack:
        0.0003     353920   1. {main}() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:0
        0.3202    1423064   2. PHPUnit_TextUI_Command::main() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:47
        0.3202    1423176   3. PHPUnit_TextUI_Command->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:100
        2.5127    4533856   4. PHPUnit_TextUI_TestRunner->doRun() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:149
        2.5826    4638848   5. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
        2.5843    4645296   6. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
        6.3418   13871320   7. PHPUnit_Framework_TestCase->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
        6.3418   13871320   8. PHPUnit_Framework_TestResult->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
        6.3418   13871320   9. PHPUnit_Framework_TestCase->runBare() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
        6.3419   13887848  10. Illuminate\Foundation\Testing\TestCase->setUp() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:764
        6.3419   13887848  11. Illuminate\Foundation\Testing\TestCase->refreshApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:64
        6.3419   13887848  12. TestCase->createApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:85
        6.3434   13907600  13. Illuminate\Foundation\Console\Kernel->bootstrap() /home/vagrant/Code/MyProject/tests/TestCase.php:23
        6.3434   13907600  14. Illuminate\Foundation\Application->bootstrapWith() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
        6.5850   14038056  15. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
        6.5850   14038056  16. Illuminate\Foundation\Application->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
        6.5850   14038400  17. array_walk() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
        6.6323   14114144  18. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
        6.6323   14114144  19. Illuminate\Foundation\Application->bootProvider() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
        6.6324   14114520  20. Illuminate\Container\Container->call() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
        6.6324   14114632  21. call_user_func_array:{/home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
        6.6324   14114696  22. GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
        6.6470   14155696  23. Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:0
        6.6604   14192432  24. Illuminate\Foundation\Bootstrap\HandleExceptions->handleException() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:118
        6.6604   14192432  25. Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:79
        6.6604   14192432  26. Illuminate\Foundation\Application->make() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:154
        6.6604   14192488  27. Illuminate\Container\Container->make() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:674
        6.6604   14192488  28. Illuminate\Container\Container->build() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:633§
    
    opened by olimorris 14
  • [Laravel 5.8] The page keeps reloading after package installation

    [Laravel 5.8] The page keeps reloading after package installation

    Expected Behavior

    I just have installed the package, in order to prevent token expiration on an ajax form

    Actual Behavior

    The page on which I have the form keeps reloading

    Environment

    • PHP Version: 7.2
    • Laravel Version: 5.8
    • LaravelCaffeine Version: 0.8.1
    unconfirmed bug 
    opened by wijourdil 13
  • CSRF Meta tag not getting updated.

    CSRF Meta tag not getting updated.

    Expected Behavior

    csrf-token meta should get updated on drip.

    Acutal Behavior

    Im using axios, I am prepending the csrf-token from the meta to the headers of the axios request. If i manually update my csrf meta tag then it gets picked up in axios however drip doesn't update the csrf-token meta.

    Environment

    • PHP Version: 7.1
    • Laravel Version: 5.6
    • LaravelCaffeine Version: ^0.6.8

    Stack Trace

    Standard token mismatch error.

    opened by darylthornhill 13
  • Routes completely broken after uninstall

    Routes completely broken after uninstall

    Laravel doesn't seem to be using any routes in /routes anymore, everything returns error 404 not found after I removed this.

    config/app.php has been updated accordingly but nothing seem to fix this.

    unconfirmed bug 
    opened by Akke 12
  • Domain url('/') breaks artisan optimize

    Domain url('/') breaks artisan optimize

    The domain => url('/') setting is breaking Laravel 5.2 artisan command.

    The website works, but the artisan command crashes with a routing error.

    PHP Catchable fatal error: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /home/vagrant/Code/salunet/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /home/vagrant/Code/salunet/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 103

    unconfirmed bug 
    opened by Kyosfonica 11
  • The included script is added in a place where it affects my site layout

    The included script is added in a place where it affects my site layout

    Expected Behavior

    Package should not affect overall site layout

    Acutal Behavior

    The package adds its scripts but also modifies my layout.

    Environment

    • PHP Version: 7.4
    • Laravel Version: ^7.0
    • LaravelCaffeine Version: 7

    Stack Trace

    Before

    image

    From line 369 where the end of the <main> is.

    After

    image

    opened by blorange2 0
  • Should fix when the device is in sleep mode

    Should fix when the device is in sleep mode

    Hello. I have a problem when my laptop is in sleep, after waking up I see an error connecting to the Internet. I found out that when this condition is met,
    my page starts to reload, but since the laptop is in sleep mode, then it does not have access to the Internet, respectively.

    I found a solution to this problem in correcting this part of the code When I added setTimeout I stopped getting infinite page reload and further connection error. Now my page reloads when my laptop wakes up.

    Fixes #78 #138

    opened by AnnaBelka 1
  • Should fix when the device is in sleep mode

    Should fix when the device is in sleep mode

    Hello. I have a problem when my laptop is in sleep, after waking up I see an error connecting to the Internet. I found out that when this condition is met,

      if ({{ $ageCheckInterval }} ) {
                setInterval(function () {
                    if (new Date() - lastCheck >= {{ $ageCheckInterval + $ageThreshold }}) {
                        location.reload(true);
                    }
                }, {{ $ageCheckInterval }});
         }
    

    my page starts to reload, but since the laptop is in sleep mode, then it does not have access to the Internet, respectively.

    I found a solution to this problem in correcting this part of the code

    if ({{ $ageCheckInterval }} > 0) {
        setInterval(function () {
            if (new Date() - lastCheck >= {{ $ageCheckInterval + $ageThreshold }}) {
                setTimeout(function () {
                    location.reload(true);
                },  Math.max(0, {{ $ageCheckInterval }} - 500) )
            }
        }, {{ $ageCheckInterval }});
    }
    

    When I added setTimeout I stopped getting infinite page reload and further connection error. Now my page reloads when my laptop wakes up.

    opened by AnnaBelka 0
  • Issue with caffeine not loading other packages correctly when it refreshes.

    Issue with caffeine not loading other packages correctly when it refreshes.

    Behavior

    When caffeine refreshes the session, other npm packages don't load correctly. I have the package voerro/vue-tagsinput along with caffeine. Everything's fine until caffeine auto refreshes page session, when it does refresh the tags input component doesn't load correctly, the css is missing ( no error in console either ) This is what it looks when caffeine refreshes session: image

    This is what it looked like before caffeine refreshed the session, what it should look like after refresh too: image

    And when I try to type something in the input image

    This works fine before caffeine refreshes the session. Any help?

    Environment

    • PHP Version: 7.4.11
    • Laravel Version: 7.29
    • LaravelCaffeine Version: 7.0.2

    Stack Trace

    opened by RoshanJafri 0
  • Expire when directly submit form after coming back

    Expire when directly submit form after coming back

    Laravel Caffeine refreshes the CRSF token every drip-interval and refreshes the whole page when the session almost expires; outdated-drip-check-interval before. But... when I open the Laravel application, close my Macbook and go to sleep. The next morning I open my laptop and I'm trying to submit the form I'm getting the expired page. Maybe we can check on window focus and refresh the token? See: https://stackoverflow.com/questions/3478654/is-there-a-browser-event-for-the-window-getting-focus

    If this is a good idea I could create a PR for this, but first I'd like to discuss this if it's a good of bad idea.

    enhancement 
    opened by royduin 9
Releases(9.0.3)
Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups.

Tenancy for Laravel Enabling awesome Software as a Service with the Laravel framework. This is the successor of hyn/multi-tenant. Feel free to show su

Tenancy 1.1k Dec 30, 2022
Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously

Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously

Tenancy 2.4k Jan 3, 2023
Filament Plugin to help implement Cloudflare turnstile into your forms.

Filament Turnstile Filament Turnstile, is a plugin to help you implement the Cloudflare turnstile. This plugin uses Laravel Turnstile Behind the scene

Coderflex 5 Jun 12, 2023
Twitter Bootstrap forms for Laravel 5

Twitter Bootstrap Forms for Laravel 5 Simple way to create forms View demo demo repository Custom form controls and shorthand methods for form rows (b

Dmitry Groza 15 Oct 31, 2019
BootstrapForm, forms for Laravel 5

BootstrapForm, forms for Laravel 5 This is a package for simply creating Bootstrap 3 styled form groups in Laravel 5. It extends the normal form build

Dwight Watson 217 Oct 24, 2022
rapyd: crud widgets for laravel. datatable, grids, forms, in a simple package

rapyd-laravel This is a pool of presentation and editing widgets (Grids and Forms) for laravel. Nothing to "generate", just some classes to let you de

Felice Ostuni 875 Dec 29, 2022
Fullstack komponents to write Forms, Queries and Menus in Laravel

kompo.io • Documentation • Demos • Twitter kompo/kompo kompo/kompo is a library of Fullstack Komponents to help you write forms, queries and menus in

Bass El Hachem 107 Dec 5, 2022
A convenient helper for using the laravel-seo package with Filament Admin and Forms

Combine the power of Laravel SEO and Filament PHP. This package is a convenient helper for using the laravel-seo package with Filament Admin and Forms

Ralph J. Smit 39 Dec 21, 2022
Provides the missing range field for the Filament forms.

The missing range field for the Filament forms. Installation You can install the package via composer: composer require yepsua/filament-range-field Pu

null 11 Sep 10, 2022
A demo of how to use filament/forms to build a user-facing Form Builder which stores fields in JSON.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Dan Harrin 41 Dec 24, 2022
Llum illuminates your Laravel projects speeding up your Github/Laravel development workflow

Llum illuminates your Laravel projects speeding up your Github/Laravel development workflow

Sergi Tur Badenas 110 Dec 25, 2022
Laravel-OvalFi helps you Set up, test, and manage your OvalFi integration directly in your Laravel App.

OvalFi Laravel Package Laravel-OvalFi helps you Set up, test, and manage your OvalFi integration directly in your Laravel App. Installation You can in

Paul Adams 2 Sep 8, 2022
🧑‍🔬 The missing assertions for your views in your Laravel applications.

Laravel View Assertions The missing assertions for your views in your Laravel applications. Installation You'll have to follow a couple of simple step

Sven Luijten 4 Dec 21, 2022
Automatically load your helpers in your laravel application.

Laravel AutoHelpers Automatically load your helpers in your laravel application. Installation You can install the package via composer: composer requi

Florian Wartner 6 Jul 26, 2021
Podcastwala - Your very own Podcast web app built with Laravel. Manage and listen to your favorite podcasts

Podcastwala Your very own Podcast web app built with Laravel 5. This web app enables you to manage RSS feeds for your favorite podcasts and listen to

null 142 Sep 14, 2022
List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Laravel Lang 6.9k Jan 2, 2023
Stop duplicating your Eloquent query scopes and constraints in PHP. This package lets you re-use your query scopes and constraints by adding them as a subquery.

Laravel Eloquent Scope as Select Stop duplicating your Eloquent query scopes and constraints in PHP. This package lets you re-use your query scopes an

Protone Media 75 Dec 7, 2022
Using this site your can buy and sell your property.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Hossain Mohammad Shahidullah Jaber 4 Nov 17, 2022
A package to keep track of your pages & understand your audience

A clean way to track your pages & understand your user's behavior Installation You can install the package via composer: composer require coderflexx/l

Coderflex 178 Jan 4, 2023