1
1
![ Coffee for Laravel] ( https://github.com/GeneaLabs/laravel-caffeine/blob/master/caffeine.jpg )
2
2
3
3
## Goal
4
- Prevent forms from timing out when submitting them after leaving them on-screen for a considerable amount of time.
5
- (Laravel defaults to 120 minutes, but that is configurable and could be different site-by-site.)
4
+ Prevent forms from timing out when submitting them after leaving them on-screen
5
+ for a considerable amount of time. (Laravel defaults to 120 minutes, but that
6
+ is configurable and could be different site-by-site.)
6
7
7
8
## Implementation
8
- To achieve this, we are sending a caffeine-drip (a request at regular intervals) to keep the session from timing out.
9
- This is only implemented on pages with a ` _token ` field, so all other pages will time-out as normal.
9
+ To achieve this, we are sending a caffeine-drip (a request at regular intervals)
10
+ to keep the session from timing out.
11
+ This is only implemented on pages with a ` _token ` field, so all other pages will
12
+ time-out as normal.
10
13
11
14
## Reasoning
12
- I chose this approach to keep the integrity of site-security, by avoiding the following:
15
+ I chose this approach to keep the integrity of site-security, by avoiding the
16
+ following:
13
17
- exposing the CSRF Token on an unsecured endpoint.
14
18
- eliminating CSRF Token validation on specific routes, or even altogether.
15
19
- removing session-timeout on all pages.
16
20
17
21
## Considerations
18
22
### Routes
19
- This package adds the routes under ` genealabs/laravel-caffeine ` . Please verify that these don't collide with your
20
- existing routes.
23
+ This package adds the routes under ` genealabs/laravel-caffeine ` . Please verify
24
+ that these don't collide with your existing routes.
21
25
22
26
### Dependencies
23
- - Your project should be running Laravel 5.1 or higher.
27
+ - Your project must be running Laravel 5.1 (LTS) or 5.3 (CURRENT).
28
+ - PHP 7.0.0 or higher.
24
29
25
30
## Installation
26
- 1 . Install Caffeine via composer:
27
-
28
- _ (Future updates will only be made to the most current version.)_
29
-
30
- For Laravel 5.1:
31
+ 1 . Installation for Laravel LTS or CURRENT:
31
32
``` sh
32
- composer require genealabs/laravel-caffeine: ~ 0.2.0
33
+ composer require genealabs/laravel-caffeine
33
34
```
34
35
35
36
For Laravel 5.2:
36
37
``` sh
37
- composer require genealabs/laravel-caffeine:~ 0.3.0
38
+ composer require genealabs/laravel-caffeine:~ 0.3.11
38
39
```
39
40
40
41
2 . Add the service provider entry in ` config\app.php ` :
@@ -53,13 +54,14 @@ existing routes.
53
54
## Configuration
54
55
The following elements are configurable:
55
56
- ** domain:** (default: ` url('/') ` ) Change to point to a different domain than
56
- your app. This is useful if you are behind a proxy or load-balancer.
57
+ your app. This is useful if you are behind a proxy or load-balancer. ___ Do not use
58
+ the ` url() ` helper in the config file.___
57
59
- ** route:** (default: ` genealabs/laravel-caffeine/drip ` ) Change to customize
58
60
the drip URL in the browser. This is just cosmetic.
59
61
- ** dripIntervalInMilliSeconds:** (default: 5 mins) Change to configure the drip
60
62
interval.
61
63
62
- You only need to publish the config file it you want to customize it :
64
+ ___ Only publish the config file it you need to customize it ___ :
63
65
``` sh
64
66
php artisan vendor:publish --tag=genealabs-laravel-caffeine
65
67
```
0 commit comments