I've seen some mention of Laravel around these parts. I'm doing something with Lumen, which is Laravel's micro-framework edition, so I thought I'd post some thoughts on the two.
As I said, Lumen is a micro-framework. The primary use-case is for building REST APIs, so everything to do with templates has been pulled out of Lumen. Out of the box, Lumen doesn't have a bunch of the libs you find in Laravel either -- Eloquent is disabled, mail is disabled, and there's no config/ dir. However, all of this can be re-enabled if you need it.
What I'm doing with the framework is building the backend for a pet game. Separately, I'll have the UI as a single-page javascript app, and 3rd party forum software. I thought Lumen would be ideal for this, but I ran into a few problems:
1. My API is the authentication source for the UI & forums. I wanted to implement an OAuth provider, which is trivial in full-on Laravel -- they have Passport, which integrates the very-good League OAuth provider code into the framework. Lumen, however, strips this out!
The challenge isn't insurmountable, though. I took a look at the Passport code and started thinking about what it would take to make it play nice with Lumen. It has some things that aren't part of the API authentication flow -- mainly, views for authorizing other apps. Fortunately, I typed some words into the googles machine at this point, and discovered that somebody had already solved the problem: https://github.com/dusterio/lumen-passport
This is working fine for me, so far. In the future, if I want to enable other apps to get API keys for a user's data, I might need to extract the OAuth provider from the main game API and deploy a small Laravel site that just runs passport.
2. The ReCaptcha lib for Laravel has some views in it, boo. I wrote a quick wrapper for the PHP ReCaptcha lib. This might actually be useful to somebody else, so splitting this off into a standalone package is on my todo list.
The site worked, but my unit test started failing. I don't really want to test the ReCaptcha code from google, so I had to mock the library. Initially, when I had written my wrapper, it was just a class. In order to get it to play nice with Mockery, I had to turn my class into a facade. This took a bit to figure out -- strangely, there wasn't that much up-to-date documentation on how to add your own facade to the framework.
3. There was no config/ dir. Because Lumen's focus is on being small and simple, I guess they decided not to have that out-of-the-box anymore. That's all well and good until you enable something that expects to find a config...
Fortunately, all they did was not create the folder by default. If you make the directory and drop files in, they'll get picked up by both the framework and any 3rd party plugins.
4. Lumen was missing major bits of illuminate (the supporting libs for Laravel & Lumen) that I wanted to use. The biggest one was Eloquent, but turning that on is trivial; there's a line commented out in the bootstrap.php file. Turn it back on and your ORM is in business.
My API is handling user signup and forgot password requests. Unfortunately, Lumen doesn't come with Illuminate/Mail. That one is a little trickier to re-enable: you've got to add it to install it with composer, register the MailServiceProvider, create a config file, and load the config in bootstrap.php.
The mail thing is another reason I'm thinking about cutting the OAuth provider out of my API and moving it to a dedicated auth provider laravel project.
Anyways, that's about it for my braindump. Aside from all the missing stuff, the final difference between Laravel & Lumen is that Lumen controllers expect you'll be spitting out JSON instead of rendering views. It's quite pleasant, assuming that's what you want to do!
So yeah. I'm happy to field questions about Lumen. You can check out my code if you're so inclined.
As I said, Lumen is a micro-framework. The primary use-case is for building REST APIs, so everything to do with templates has been pulled out of Lumen. Out of the box, Lumen doesn't have a bunch of the libs you find in Laravel either -- Eloquent is disabled, mail is disabled, and there's no config/ dir. However, all of this can be re-enabled if you need it.
What I'm doing with the framework is building the backend for a pet game. Separately, I'll have the UI as a single-page javascript app, and 3rd party forum software. I thought Lumen would be ideal for this, but I ran into a few problems:
1. My API is the authentication source for the UI & forums. I wanted to implement an OAuth provider, which is trivial in full-on Laravel -- they have Passport, which integrates the very-good League OAuth provider code into the framework. Lumen, however, strips this out!
The challenge isn't insurmountable, though. I took a look at the Passport code and started thinking about what it would take to make it play nice with Lumen. It has some things that aren't part of the API authentication flow -- mainly, views for authorizing other apps. Fortunately, I typed some words into the googles machine at this point, and discovered that somebody had already solved the problem: https://github.com/dusterio/lumen-passport
This is working fine for me, so far. In the future, if I want to enable other apps to get API keys for a user's data, I might need to extract the OAuth provider from the main game API and deploy a small Laravel site that just runs passport.
2. The ReCaptcha lib for Laravel has some views in it, boo. I wrote a quick wrapper for the PHP ReCaptcha lib. This might actually be useful to somebody else, so splitting this off into a standalone package is on my todo list.
The site worked, but my unit test started failing. I don't really want to test the ReCaptcha code from google, so I had to mock the library. Initially, when I had written my wrapper, it was just a class. In order to get it to play nice with Mockery, I had to turn my class into a facade. This took a bit to figure out -- strangely, there wasn't that much up-to-date documentation on how to add your own facade to the framework.
3. There was no config/ dir. Because Lumen's focus is on being small and simple, I guess they decided not to have that out-of-the-box anymore. That's all well and good until you enable something that expects to find a config...
Fortunately, all they did was not create the folder by default. If you make the directory and drop files in, they'll get picked up by both the framework and any 3rd party plugins.
4. Lumen was missing major bits of illuminate (the supporting libs for Laravel & Lumen) that I wanted to use. The biggest one was Eloquent, but turning that on is trivial; there's a line commented out in the bootstrap.php file. Turn it back on and your ORM is in business.
My API is handling user signup and forgot password requests. Unfortunately, Lumen doesn't come with Illuminate/Mail. That one is a little trickier to re-enable: you've got to add it to install it with composer, register the MailServiceProvider, create a config file, and load the config in bootstrap.php.
The mail thing is another reason I'm thinking about cutting the OAuth provider out of my API and moving it to a dedicated auth provider laravel project.
Anyways, that's about it for my braindump. Aside from all the missing stuff, the final difference between Laravel & Lumen is that Lumen controllers expect you'll be spitting out JSON instead of rendering views. It's quite pleasant, assuming that's what you want to do!
So yeah. I'm happy to field questions about Lumen. You can check out my code if you're so inclined.