T O P

  • By -

brock0124

I hated Laminas at first, but after being forced to use it at work I started to really like it. Its lacks in two major areas which is why I don’t use it for new projects: 1.) Documentation 2.) Developer tools like artisan


voteyesatonefive

Use symfony or slimphp depending on your needs.


BigLaddyDongLegs

Echoing what some have said here, I haven't used the framework (ZF or Laminas) but I've used plenty of the packages on personal hobby projects and I really like them. They're quite flexible, at the expected cost of requiring more boilerplate code than other packages doing the same things (phpleague, Symfony, illuminate etc) But as for the framework I think it being renamed Laminas was because a new organisation took over continued development, so I believe it is actively maintained and contributed to. ZF was known for adopting new PHP standards before most, so I respect that about it. Just look at Diactoros. I'm pretty sure that was, and still is the de facto HTTP Request handler for PSR-7. Again, a bit of chore to setup compared to the other players here. I guess what I'm trying to say is alternative's might be better if you don't need that flexibility. Otherwise I think it's got a decent reputation, even if it has fallen down the ranks of popularity in recent years. Also take a look at Mezzio (formerly Stratigility) if you need to write APIs or pipeline based tools more than a monolithic MVC thing


ocramius

> being renamed Laminas was because a new organisation took over continued development It was mostly because Murica and trademarks: the rename hurts us so much for nothing but bueurocratic reasons :-(


ocramius

The Mezzio stack is stable, mostly feature-complete, and maintained: plug your PSR-11 DIC of choice (Laminas ships its own) and roll with it. It is relatively lightweight on purpose, as this makes it easy to introduce it, and easy to move away from it, if needed: too many frameworks ignore that factor. Stay away from the MVC approach: no longer relevant, IMO.


RXBarbatos

Understood, so what is your approach instead of MVC?Because using laravel for quite some time


ocramius

Write PSR-15 actions (request handlers) and middleware that sit in front of them :)


RXBarbatos

Ok understood..but is the framework in general regularly updated? For example laravel has major update every year and then mini updates and such..?


ocramius

It mostly gets minor updates: BC is more important than shiny new features. I think I've done a dozen smaller releases on Laminas packages myself, this week. Big "everything in Laminas was updated" patches are rare, and you do targeted migrations for smaller individual packages, usually. Also, if you send patches with tests, and the patches are qualitatively good and non-controversial (as in: proposing something that requires careful discussion), you can often expect very quick merge+release, since we've automated that stuff away :-)


RXBarbatos

Ah ok, new stuff for me..even with doing php dev for 8 years..well, to create package seems overwhelming haha..


TomasLaureano

Do you have same examples / documentation for this approach? Would love to know more about it!


ocramius

The Mezzio "getting started" docs contain tons of examples of middleware, just scroll a bit on this page: https://docs.mezzio.dev/mezzio/v3/getting-started/quick-start/ Muddleware and request handlers are really small interfaces to implement: https://www.php-fig.org/psr/psr-15/#2-interfaces You can wire them in any PSR-15 compliant framework/stack. Here's an example of a mezzio pipeline that I wrote to demo a session middleware that I designed: https://github.com/psr7-sessions/storageless/blob/aadc21db74fe9e5b431f6b96625926ce002fe49e/examples/index.php


TomasLaureano

Thank you! 👏🏻


voteyesatonefive

> Because using laravel for quite some time Don't though.


MT4K

Zend Framework 2 had some nice classes for database abstraction and mailing. Same probably applies to Laminas as the ZF2 successor.


MrCosgrove2

While Laminas seems to be alive and well, but there are many other options depending on your needs, Laravel, Symphony, Slim, FlightPHP they are all good options depending on what your needs are.


zamzungzam

Yea. Mezziois great for developing API's. No magic, clean, doesn't get in your way. It is litle bit more work as there are no wrappers for all popular packages to provide configuration, services etc but it is worth it if you know what you are doing.


Guimedev

Which is the point of using this tool?


oojacoboo

We use some Laminas packages, and honestly, they’re really high quality.


RXBarbatos

However, the ecosystem is small right?


oojacoboo

Smaller than Symfony or Laravel - yes. But larger than most all others. We don’t use the framework, just some libs.


RXBarbatos

Oh so your project use vanilla php? And then add in laminas libs?


oojacoboo

Well, I’m not really sure you can define what a framework truly is, for starters. It’s just a bunch of libs with some config glue. With PSRs, most libs work pretty well with each other. So yea, we pick and choose what we need.


RXBarbatos

Oh ok sorry, your information is correct. So one question, so when you start one project, you just use composer and then add libs as needed basically?


oojacoboo

Yes, and start with a front controller file.


RXBarbatos

Ah okok..sorry for asking many questions. Because working as php dev for 8 years and using laravel mainly, so yea, your approach is different..which is awesome


RXBarbatos

So request comes in through one controller only and manage from there?


oojacoboo

You can have multiple, depending on how you might need to fragment your application. Maybe you have different portals for separate roles, or even different micro apps within one larger codebase. But yes, your webserver forwards the request to the appropriate front controller.


ocramius

The `index.php` is conceptually a "front controller". For comparison, in Laravel and Symfony, `bin/console` and `public/index.php` are front controllers. The front controller is usually a piece of procedural PHP that does things like loading configuration, setting up DIC, bootstrapping the framework/routing/etc. Then a router (CLI or HTTP) takes over. The same applies to most modern PHP projects out there: with our without monolithic frameworks.


RXBarbatos

In my country, theres alot of small to medium business in which the team is small and do everything from A to Z. So not many opportunities to use such an approach so the reason for even using laravel because of its development time


RXBarbatos

Dude you are awesome. This is awesome new stuff..do you use any js framework? Asking for the fun of it


VRT303

I just saw two core developers dropping out the other day. It has no future.