12 ms·
Lumen – A micro-framework by Laravel
- fideloper 11y agoAlso interested to see what projects use this as a core "micro framework" service or with an SOA architecture. Seems like good flexibility between framework power and lightweight.
- deleted 11y ago[deleted]
- laravel 11y agoThe upcoming PHP 7 version releasing this fall has significant speed improvements.
- theg2 11y agoAnd what would you propose using instead? Every language has its ups and downsides and the majority of problems (anecdotally anyways) come not from the language but the data store availability and ability to scale anyways.
- ericbarnes 11y agoWell PHP still rules the hosting landscape. If your company already has php developers then switching languages may not be that easy.
- acomjean 11y agoI worked at a company that did remote energy monitoring (circuit by circuit, minute by minute for thousands of monitors). We did all the math in PHP, preping, summarizing data and sending it down to web services. It wasn't fast, but it couldn't be considered slow by any stretch. Plus php has a large library of components (Zend, symfony) and a package manager (composer) that make web development significantly easier.
- jawngee 11y agoWell, I'm sure there were a number of key factors involved. I'm currently porting a rails app to Laravel and the speed boost has been pretty remarkable, not to mention not ever having to install gems whose only purpose is to reboot unicorn when the memory leaks hit a certain threshold. I didn't choose Laravel because I like PHP (I don't), I chose it because of the need to balance ease of development with speed with having less skilled developers be able to maintain it with a modicum of safety. Not to mention how ridiculously easy it is to horizontally scale PHP. I'd like PHP more if they dropped the f*cking $ sign though. It's a good tool if you need to get shit done.
- plug 11y agoThe dollar sign usually only bothers me after I've gone away and written a little Python. Actually, has anyone ever tried a 'CoffeeScript for PHP' that removed the dollar sign, replaced the `->` with dot syntax, and smoothed over the various other syntax features that people complain about? Not that I'd think there'd be much point really, apart from being a fun project.
- giaour 11y agoNot sure how actively maintained it is, but you could try Mammouth: http://mammouth.wamalaka.com/ http://mammouth.wamalaka.com/ My only hesitation with it has been that you need Node.js to compile it to regular PHP -- it offers no analogue to coffeescript's eval-in-browser mode for development.
- thebouv 11y agoI love the $ sign -- super easy to see variables versus just bare words where you just rely on case or naming convention. Of course, my first language was Perl, so I've been in love with the $ for ages.
- giaour 11y agoPHP makes for fast development, even if there are languages out there that offer faster execution. Laravel has been ~100% HHVM compatible for a while, so you might not even have to worry about execution speed if you go with Lumen.
- wesray 11y agoThe drop in functionality right into the full framework is fantastic. Really like the ability to write API's with much less overhead, which was a factor that came into play for me recently. Nicely done Mr. Otwell.
- cdnsteve 11y agoThis is a serious advantage to other frameworks if this principal holds true. I think anyone working in PHP has had their tails burnt a little too often with all the framework churn.
- debaserab2 11y agoThis is definitely a very cool feature and makes this a very good candidate for MVP's or prototypes. I'm not a huge Laravel fan, but this feature alone might sway my decision.
- xrstf 11y agoThe same holds true for Silex[1], the Symfony Components-based micro framework. Silex and Lumen look very similar (not only because Laraval/Lumen use Sf Components as well), not only because both use (just as Laravel) Sf Components. Slim 3 seems to move in the same direction of modern PHP frameworks, where you return a response from your controller, instead of setting up some global state (the main thing I don't like about Slim 1 & 2). For now, Silex is still my favorite, as it has the temporary bonus of having more providers available to integrate 3rd party libraries. Sure, I can drop-in whatever library I like, but having someone do the setup (configuring Twig alone can be a burden if you want to get it right) just makes it easier for me ;) [1] http://silex.sensiolabs.org/ http://silex.sensiolabs.org/
- hising 11y agoLooks nice, I really like Slim Framework, this looks a lot like Slim from what I could tell. Gonna be interesting to see how (if at all) this will effect some performance focus from the Slim developers.
- jonkiddy 11y agoI completely agree. I've used Slim in lieu of Laravel for a number of small API projects. I'm excited about porting them over to Lumen.
- mcao 11y agoHave you ever tried Flight, http://flightphp.com http://flightphp.com? It has a smaller footprint than Slim but still has the ability to drop in PHP components. Disclaimer, I'm the author of Flight.
- jonursenbach 11y agoCurious, but why don't your docs request that the install be done with Composer? Manually downloading a tarball isn't the best solution for managing an application dependency.
- nodesocket 11y agoWe (https://commando.io https://commando.io) use Flight for our API and love it. Super minimal, but provides all the functionality we require. The ability to map custom functions into the Flight namespace is great.
- hising 11y agoOfficial blog post on Lumen on the Slim Framework website: http://www.slimframework.com/2015/04/14/lumen.html http://www.slimframework.com/2015/04/14/lumen.html
- 0x0 11y agoAny thoughts on how this will compare to Silex?
- sneak 11y agoAnyone still using PHP in 2015 is doing it wrong.
- ceejayoz 11y agoAnyone still hating on PHP in 2015 is doing it wrong.
- sneak 11y agoSaying "it's the wrong tool for the job" and hating on it are two different things.
- ceejayoz 11y agoAnd you said anyone using PHP in 2015 is doing it wrong, which given that you don't know what "the job" someone might be using it for, seems to head over to the "hating on it" territory. PHP in 2015 means great frameworks like Symfony/Laravel, high performance with HHVM (and soon PHP7), good package management with Composer, etc. It has made great strides.
- juliangregorian 11y agoIt's playing catch-up, and it's severely hampered by its refusal to break backwards compatibility for anything. I did a PHP contract last year after not having done PHP in years. I had genuinely high hopes for it because of having seen sentiments like yours. And Symfony is a pretty okay framework (but not great), Composer is decent, and HHVM is a pretty fast VM. But the language itself has fundamentally not changed at all -- it's still flawed in deep ways, while the developers seem mainly preoccupied with adding as many features from Java as they can. In 2015, I see someone defending PHP and I think they simply don't know any other language.
- imakesnowflakes 11y agoNo. http://www.reddit.com/r/PHP/comments/2zhg6z/how_true_is_this_php_bashing/cpjhx04 http://www.reddit.com/r/PHP/comments/2zhg6z/how_true_is_this... Read that and tell me that it is Ok..And see how that comment has been downvoted. That is PHP community for you. In 2015.
- debaserab2 11y agoWhere's the source for the benchmarks that are displayed as the first item on the project page for this?
- deleted 11y ago[deleted]
- seandavidfisher 11y agoLooks really interesting. PHP may not be the "hip" language to use (although it's getting better), but it's so popular and accessible that disregarding it as a legitimate option for new projects is myopic.
- pyre 11y agoI've talked to people doing large-scale deployments in PHP that complain about things like memory-leaks, etc in the language, so I'm not entirely convinced that PHP is really an excellent language (and runtime) that just happens to get a bad rap.
- cweagans 11y agoI'm a PHP developer that works for a major media company. We do large scale deployments, and I'd like to say that PHP is a terrible language that gets a bad rap. It's getting better, and it's already 1000000x better than the PHP4 days, but it's still not a nice language. It's not a nice runtime. The only thing nice about it is that a zillion people and their dogs all know it and it's relatively easy to deploy.
- smt88 11y agoAny experience with HHVM yet?
- cweagans 11y agoWe haven't been/won't be using it. Most of our traffic is anonymous, so we can optimize other parts of our stack. We'd rather not have to debug weird shit that comes up because of HHVM incompatibility.
- look_lookatme 11y agoDo you use an off the shelf framework or CMS?
- 11y ago
- pearjuice 11y agoIf Lumen can use all Laravel its components, can't Laravel use Lumen its routing engine or whatever makes it that fast? What's the key difference that Lumen is considered "fast and micro" over a standard Laravel installation?
- McGlockenshire 11y agoThe routing engine is NikiC's excellent FastRoute: https://github.com/nikic/FastRoute https://github.com/nikic/FastRoute My understanding is that the majority of the advertised speed increase has to do with lazy initialization of the request/response stuff and the need to expressly ask for things like session support. e: Here's an explanation from reddit, http://www.reddit.com/r/PHP/comments/32kajb/lumen_php_microframework_by_laravel/cqbzp32 http://www.reddit.com/r/PHP/comments/32kajb/lumen_php_microf...
- noir_lord 11y agoPretty much. Laravel's strength is that it is batteries included but for some stuff this can be a weakness, API's where that 30-40ms load time matters for example. I've spent a couple of years working with and on laravel projects and mostly I like it a great deal but it is a sledgehammer when sometimes you need a ballpein.
- sergiotapia 11y agoHow painless is deploying a Lumen/Laravel application? I used to use PHP back in 2006 and I remember deploying was as easy as pushing a .php file via FTP. Has the experience remained the same? PHP was incredibly simple to deploy.
- mmmm 11y agoYes, and even more so with https://envoyer.io/ https://envoyer.io/ - according to the website a Laravel product.
- deleted 11y ago[deleted]
- jonkiddy 11y agoHow is this different from Laravel Forge? https://forge.laravel.com/ https://forge.laravel.com/
- mmmm 11y agoTaylor Otwell have replied to a similar question here before: https://laracasts.com/discuss/channels/general-discussion/envoyerio-forge https://laracasts.com/discuss/channels/general-discussion/en... > They really aren't similar at all. Forge manages sub-domains, Nginx, Cron jobs, SSL certificates, queue daemons, recipes, etc. Envoyer does none of those things. Envoyer is solely focused on deploying PHP applications to multiple servers with zero downtime.
- rawfan 11y agoForge does server provisioning and Envoyer does deployment of PHP web applications. So not quite the same at all.
- ing33k 11y agoyou can still do that.
- cweagans 11y ago
- ing33k 11y agoglad to see use of symfony/http-kernel and symfony/http-foundation .
- jbrooksuk 11y agoLaravel itself uses these components. https://github.com/laravel/framework/blob/513960ff768c3bbe9d19c4923e3564de3dff745c/composer.json#L35-36 https://github.com/laravel/framework/blob/513960ff768c3bbe9d...
- crazychrome 11y agolooks good, only 7 years late to the game.
- arenaninja 11y agoWell, consider that Silex and Slim have been out for a while already and no, not really. I think it's about having options more than anything else at this point
- pankajdoharey 11y agoWhat Rails is to Laravel, Sinatra is to lumen. Nothing more than another copycat idea from the ruby/rails world.
- chias 11y ago> What Rails is to Laravel, Sinatra is to lumen. Nothing more than another copycat idea from the ruby/rails world. I must be misunderstanding your point, because the way I read what you wrote, you are insinuating that incorporating good ideas already implemented in a different incompatible technology stack is worthless. E.g. making a good text editor for windows is worthless because vim/emacs exists, or making a python library for parsing HTML is worthless because there is already a perl one?
- makeitsuckless 11y agoThis attitude, the illusion that RoR is year zero in software development is the #1 reason why Rails has become toxic for many companies. Hordes of hipster RoR developers making the same mistakes all over again because they refuse to learn from mistakes already made by others. Turning project after project into an unmanageable mess with a marginal life expectancy because they believe their superior elegant language and one-size-fits-all opinionated framework means they don't have to think about architecture and design. In all my years I've never seen a developer movement piss away its initial success so rapidly as the Rails community.
- JimmaDaRustla 11y agoThey compare it to Slim 3, which isn't completed yet, sitting in a development branch... Slim 3 will also be PSR-7 compliant, I don't see anything about that anywhere in these Lumen docs.
- giaour 11y agoThe framework's author addressed this on reddit: http://www.reddit.com/r/PHP/comments/32kajb/lumen_php_microframework_by_laravel/cqc1hml http://www.reddit.com/r/PHP/comments/32kajb/lumen_php_microf...
- JimmaDaRustla 11y agoInteresting. I guess he/she is implying that Lumen is PSR-7 compliant than by the last sentence? Thanks!
- giaour 11y agoLumen uses the same request and response objects as Laravel, which extend Symfony's request and response objects, on which PSR-7 is based. If Lumen isn't PSR-7 compliant once that standard is finalized, it will be shortly.
- dustinlakin 11y agoPHP frameworks have come a long way, and so has the language. The big thing that stands out, is that three of the best frameworks in the space (Laravel, Symfony and Slim) work together and feel a friendly/healthy sense of competition. They are reusing each others components and building a much more promising future for PHP.
- monk_e_boy 11y agoDrupal 8 is based on Symfony -- things are really moving in the right direction. Personally, I was a huge fan of Zend Framework + Doctrine, but these frameworks are all mature and great to use.... almost as good as Rails (lol, OK, OK, don't mention Ruby within earshot of PHP fans ;) [edit] down voted for my opinion! Argh my tiny karma is depleted -- damn you ruby, damn you to hell!
- imaginenore 11y agoDrupal is becoming more and more insane with each release (especially 6 -> 7). The database structure is really getting out of hand. It's becoming harder and harder to deal with the performance issues.
- monk_e_boy 11y agoYeah... I don't know what to think about performance. We tend to be careful with page design and cache everything so once the cache is built the site flies. But developing a drupal site is painful. Clearing the cache every few minutes takes forever.
- jcroll 11y agoWhich project reuses laravel components?
- cweagans 11y agoLaravel is built on Symfony components, and much of Laravel can be used outside of Laravel.
- j42 11y agoAs someone who develops/maintains many high-IO requirement PHP microservices (as part of a service-oriented architecture, or, SOA), I'm torn on this one. Laravel is one of my favorite frameworks, especially since 5.0 given its noble attempt to adhere to contract-first/interfaced development and many best practices that in some ways prevent the "worst" kinds of code from being written. It's not static typing, but it's a step in the right direction. This seems like it's heavily optimized over the Laravel base, and if high speed and concurrency is important enough that you'd choose Lumen, then it seems like you'd still be stopping halfway in a bit of a "if you have a hammer everything seems like a nail" situation. Unless I'm missing something Lumen still requires resources to be bootstrapped on request, and ultimately that (in the context of a framework) will lead to memory leaks in a loosely-typed language; no way around that. Also because disk writes will quickly become the bottleneck before your network capacity does, the two most relevant performance enhancements are to use a non-blocking event-loop (with expensive writes deferred to a tick cycle) and to completely avoid any unnecessary per-request bootstrapping--best done with raw PHP and ideally kept simple. This, combined with an optimized TCP configuration and split-per-process nginx LB at the head will give me r/s 10-50x the purported benchmarks. As much as 1000x when introducing intelligent edge-caching rules. Is there a situation where this would be the right tool for the job/more ideal than the base framework but not worthy of a "roll-your-own" solution? Either way +1 for Taylor Otwell as a developer and the general quality of his code/releases--Laravel is an ambitious project, and as a developer quite enjoyable to work with!
- monk_e_boy 11y agoI guess if the micro service is using a bunch of shared code from a Laravel project (maybe just interfacing with the database) or if your team is large and already using Laravel, then the first step of optimizing a service into a 'micro service' is to use Lumen. Then step two (if Lumen isn't going fast enough) is to go raw PHP as you described. But if your service is getting that popular, memory leaks are going to be a problem, maybe moving to HipHop (or whatever it's called now) or Node or something is a better idea. Sounds like you're having fun!
- j42 11y ago
- bhauer 11y agoI've just created an issue [1] in our FrameworkBenchmarks project to solicit an implementation of our tests on Lumen. If anyone here is willing to contribute such an implementation, it would be greatly appreciated. The promise of performance caught my eye! Incidentally, Round 10 is arriving soon. [1] https://github.com/TechEmpower/FrameworkBenchmarks/issues/1530 https://github.com/TechEmpower/FrameworkBenchmarks/issues/15...
- imaginenore 11y agoI hope they add React-PHP.
- EGreg 11y agoI'm sure this is great, but can I see some benchmarks? I think many frameworks allow you to include the "basic" subset of the framework, without running all the usual Inversion of Control bootstrapping.
- quaffapint 11y agoFor a micro framework, highly recommend FatFreeFramework - You can see in the upcoming benchmarks how incredibly well it performs for a drop-in (non-compiled) framework... http://www.techempower.com/benchmarks/previews/round10/#section=data-r10&hw=peak&test=query&l=sg http://www.techempower.com/benchmarks/previews/round10/#sect... ...Also I've found it much easier to learn and use than ones like laravel.
- Beatus 11y agoI've just created a project with lumen to have a look at it and lumen and all its vendor packages (with --no-dev and without tests) contain 1522 files and 102449 lines of code – according to cloc. Am I doing something wrong or why does it call itself a "micro-framework". A newly created Slim project contains 7417 lines of code.
- pan69 11y agoHow many lines of code should a micro framework have?
- Beatus 11y agoIt should be near other PHP micro-frameworks: - BulletPHP: 3946 lines of PHP code - Slim: 7329 lines of PHP code - limonade: 3669 lines of PHP code - Lumen: 95'220 lines of PHP code You can't call it a micro framework if it's more than ten times bigger than all the other ones.
- pan69 11y agoLines of code is obliviously not a benchmark to rank a micro framework. The term "mirco" refers to the amount of functionality the framework exposes. Often a micro framework is just a router decorated with some other useful stuff. Who cares about lines code, especially when you count "all" dependencies in vendor.
- adaml_623 11y agoReally the biggest drawback to PHP is the lower salaries
- mildweed 11y agoMarket salaries are for rank and file coders. Build something that's wildly successful, and it won't matter what the language was.
- evoratec 11y agoLumen is not micro, is a Slim-Laravel.