Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Sys32's avatar
Level 3

No CSRF, Session or Old.

I am rewriting a plain php site to use Lumen for a customer to allow a simple knowledgebase with no outside access to posting, 5 pages of HTML and a contact form. So instead of hosting full Laravel, I wanted to use Lumen.

I ran into a few issues. I enabled Facades and Eloquent, it looked like it was going to be okay. However a few problems came up.

  1. I cannot seem to use the old() function in views.
  2. I cannot seem to use the session() function in views.
  3. I cannot seem to use the CSRF function in views either (for contact form).
  4. I am probably also going to have problems sending e-mail to a predefined [email protected] email.

What steps should I take to make this work? I feel its a bit over the top to go full out Laravel with this tiny project.

0 likes
2 replies
schmidtke182's avatar

As far as I know, has Lumin most things disabled unless you need them. (haven't really worked with Lumen yet).

To use the CSFR function, have a look at this post:

https://laracasts.com/discuss/channels/lumen/lumen-csrf-token-mismatch

the old() function isn't even in the documentation and with your 2. and 4. point I'm not sure on how to. Anyway, even Laravel seems a bit over the top for your project, I would use it in your case. It would be finished just so much quicker. (I'm more familiar with Laravel then with Lumen).

Sys32's avatar
Sys32
OP
Best Answer
Level 3

I ended up coding alternatives for this mostly. I didn't really need the old function. Instead of sessions I use ajax for requests and display errors using javascript on the page so Lumens Json output wasn't a problem.

CSRF token wasn't really a requirement either, I added rechapta to sort any cross site scripting and bots.

Emails was sorted using various methods. But mainly require the mailer package, create a service for it in the AppServiceProvider (enable in app.php), create a mail.php and service.php file using laravel's as templates.

Please or to participate in this conversation.