I created a fresh leaf project, and then, without changing anything, served it with php -S and tried to access it with my browser. The following error is displayed in my browser:
Leaf cookie not found. Run leaf install cookie or composer require leafs/cookie.
To Reproduce
Steps to reproduce the behavior:
Create a new project by running leaf create asdf --v3 --basic
Serve it on localhost:8080
Navigate to localhost:8080 with Firefox or some other browser.
Expected behavior
I expect the leaf cli to add all the required dependencies to make the generated project work out of the box.
On the other hand I'm wondering why leafs/cookie is an optional module, since basically every usecase will require the module. Checking the code of response()->json() and other response methods, it seems like the code will always try to call the sendCookies method even though I don't tell the framework to set any cookies anywhere. If this method is always called, the cookies module might as well be part of the core "leafs/leaf" package.
Additional context
leaf --version shows v2.6.0
Note that the same problem exists with the instructions given in the README.md of the leaf repository for a composer installation without the leaf cli. composer require leafs/leaf will not install the cookie module, so the given example won't work out of the box. Same for the documentation on the website: https://leafphp.dev/docs/introduction/installation.html#composer
Describe the bug
I created a fresh leaf project, and then, without changing anything, served it with
php -S
and tried to access it with my browser. The following error is displayed in my browser:To Reproduce Steps to reproduce the behavior:
leaf create asdf --v3 --basic
Expected behavior
I expect the leaf cli to add all the required dependencies to make the generated project work out of the box.
On the other hand I'm wondering why
leafs/cookie
is an optional module, since basically every usecase will require the module. Checking the code ofresponse()->json()
and other response methods, it seems like the code will always try to call thesendCookies
method even though I don't tell the framework to set any cookies anywhere. If this method is always called, the cookies module might as well be part of the core "leafs/leaf" package.Additional context
leaf --version
shows v2.6.0Note that the same problem exists with the instructions given in the
README.md
of the leaf repository for a composer installation without the leaf cli.composer require leafs/leaf
will not install the cookie module, so the given example won't work out of the box. Same for the documentation on the website: https://leafphp.dev/docs/introduction/installation.html#composer