1 | <?php |
||
2 | |||
3 | /** |
||
4 | * This file is part of dimtrovich/cart". |
||
5 | * |
||
6 | * (c) 2024 Dimitri Sitchet Tomkeu <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view |
||
9 | * the LICENSE file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | use Dimtrovich\Cart\Handlers\Cookie; |
||
13 | |||
14 | return [ |
||
15 | /** |
||
16 | * Default handler to use for manage cart storage |
||
17 | * |
||
18 | * @var class-string<\Dimtrovich\Cart\Contracts\StoreManager> |
||
19 | * |
||
20 | * - Dimtrovich\Cart\Handlers\Cookie |
||
21 | * - Dimtrovich\Cart\Handlers\Session |
||
22 | */ |
||
23 | 'handler' => Cookie::class, |
||
24 | |||
25 | /** |
||
26 | * Default tax rate |
||
27 | * |
||
28 | * @var int |
||
29 | */ |
||
30 | 'tax' => 21, |
||
31 | |||
32 | /* |
||
33 | |-------------------------------------------------------------------------- |
||
34 | | Default number format |
||
35 | |-------------------------------------------------------------------------- |
||
36 | | |
||
37 | | This defaults will be used for the formated numbers if you don't set them in the method call. |
||
38 | */ |
||
39 | 'format' => [ |
||
40 | 'decimals' => 2, |
||
41 | |||
42 | 'decimal_point' => '.', |
||
43 | |||
44 | 'thousand_seperator' => ',', |
||
45 | ], |
||
46 | |||
47 | /* |
||
48 | |-------------------------------------------------------------------------- |
||
49 | | Configuration for specific storage handler |
||
50 | |-------------------------------------------------------------------------- |
||
51 | */ |
||
52 | 'options' => [ |
||
53 | /** |
||
54 | * Options for cookie handler |
||
55 | */ |
||
56 | Cookie::class => [ |
||
57 | /** |
||
58 | * -------------------------------------------------------------------------- |
||
59 | * Cookie Expires Timestamp |
||
60 | * -------------------------------------------------------------------------- |
||
61 | * |
||
62 | * Default expires timestamp for cookies. Setting this to `0` will mean the |
||
63 | * cookie will not have the `Expires` attribute and will behave as a session |
||
64 | * cookie. |
||
65 | * |
||
66 | * @var DateInterval|DateTimeInterface|int |
||
67 | */ |
||
68 | 'expires' => env('cookie.expires', 60), |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
69 | |||
70 | /** |
||
71 | * -------------------------------------------------------------------------- |
||
72 | * Cookie Path |
||
73 | * -------------------------------------------------------------------------- |
||
74 | * |
||
75 | * Typically will be a forward slash. |
||
76 | * |
||
77 | * @var string |
||
78 | */ |
||
79 | 'path' => env('cookie.path', '/'), |
||
80 | |||
81 | /** |
||
82 | * -------------------------------------------------------------------------- |
||
83 | * Cookie Domain |
||
84 | * -------------------------------------------------------------------------- |
||
85 | * |
||
86 | * Set to `.your-domain.com` for site-wide cookies. |
||
87 | * |
||
88 | * @var string |
||
89 | */ |
||
90 | 'domain' => env('cookie.domain', ''), |
||
91 | |||
92 | /** |
||
93 | * -------------------------------------------------------------------------- |
||
94 | * Cookie Secure |
||
95 | * -------------------------------------------------------------------------- |
||
96 | * |
||
97 | * Cookie will only be set if a secure HTTPS connection exists. |
||
98 | * |
||
99 | * @var bool |
||
100 | */ |
||
101 | 'secure' => env('cookie.secure', false), |
||
102 | |||
103 | /** |
||
104 | * -------------------------------------------------------------------------- |
||
105 | * Cookie HTTPOnly |
||
106 | * -------------------------------------------------------------------------- |
||
107 | * |
||
108 | * Cookie will only be accessible via HTTP(S) (no JavaScript). |
||
109 | * |
||
110 | * @var bool |
||
111 | */ |
||
112 | 'httponly' => env('cookie.httponly', true), |
||
113 | |||
114 | /** |
||
115 | * -------------------------------------------------------------------------- |
||
116 | * Cookie SameSite |
||
117 | * -------------------------------------------------------------------------- |
||
118 | * |
||
119 | * Configure cookie SameSite setting. Allowed values are: |
||
120 | * - None |
||
121 | * - Lax |
||
122 | * - Strict |
||
123 | * - '' |
||
124 | * |
||
125 | * Defaults to `Lax` for compatibility with modern browsers. Setting `''` |
||
126 | * (empty string) means default SameSite attribute set by browsers (`Lax`) |
||
127 | * will be set on cookies. If set to `None`, `$secure` must also be set. |
||
128 | * |
||
129 | * @phpstan-var 'None'|'Lax'|'Strict'|'' |
||
130 | * @var string |
||
131 | */ |
||
132 | 'samesite' => env('cookie.samesite', 'Lax'), |
||
133 | ], |
||
134 | ], |
||
135 | ]; |
||
136 |