DEV Community

dewbiez
dewbiez

Posted on

PHP Frameworks Discussion (beware lots of opinions)

I prefer either Phalcon, or modular with independent composer packages that are not coupled to others. I did Laravel development for a while, but I couldn't seem to get the performance I wanted out of it.

What about you?

Top comments (42)

Collapse
 
perttisoomann profile image
Pert Soomann

CodeIgniter 4 just reached first public beta stage too.

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
perttisoomann profile image
Pert Soomann

That's why v4 release is exciting - bcit-ci.github.io/CodeIgniter4/int...

Collapse
 
devmazee2057282 profile image
dewbiez

Following PSRs is not required, nor does it make it any better in my opinion.

Not following PSRs does not make it worse of a framework.

Thread Thread
 
Sloan, the sloth mascot
Comment deleted
 
perttisoomann profile image
Pert Soomann

It's a weird one.

On one hand you can never be certain any standard fits all cases, and you know the more creative developers want to do their own flavour thing.

On the other, it was much easier to tell the whole team here to just follow the damn PSR-1 / PSR-2 instead of everyone re-inventing their own weird slightly different visual coding style. Minus the spaces over tabs of course, but that's a whole another can of worms :D

All in all I probably agree more with having standards over not having one, so yeah, looking quite forward to what they've done.

Haven't checked PSR's out for a while, have they done something security based, ie don't output user input without escaping html tags first, etc?

Thread Thread
 
devmazee2057282 profile image
dewbiez

I do prefer PSR over none as well. But I'm just trying to keep an open-mind and not dissing a framework just because it doesn't follow the standards.

Thread Thread
 
perttisoomann profile image
Pert Soomann

I'm not too bothered about it either, but people who do like it, for them it might be much higher in consideration priority than for you or me.

And to get more people on board with new version, it's good thing that they've considered it.

Thread Thread
 
Sloan, the sloth mascot
Comment deleted
 
perttisoomann profile image
Pert Soomann

Oh sure, you can't make Security PSR-101 and push all the responsibility to framework. Most of the time frameworks are as secure as they can get and all the issues come from however coders do their stuff, or probably 50% of the time, how servers are set up, which has nothing to do with code at all.

Said that, people like to follow simple checklists. And PSR-1 and PSR-2 are about "style" and some parts have nothing to do with actual coding, so secure "style" could potentially be documented same way.

I know there are few of these kicking about, and there are more general language agnostic lists, but PSR has a bit of authority in PHP community, so if they did it, I think it would get bigger following, even if it's just virtually copying already existing check lists.

Also, I am yet to meet a PHP developer who prefers spaces over tabs.

Thread Thread
 
rikudousage profile image
RikudouSage

Nice to meet you, I use spaces!

Thread Thread
 
perttisoomann profile image
Pert Soomann

Me too now, moved to another company that fully hours for psr-2 🤓

Collapse
 
david_j_eddy profile image
David J Eddy

With PSR adoption CI4 does indeed look like a much better contender. I'll keep my eye on this release.

Collapse
 
buphmin profile image
buphmin

For php I have worked with Symfony and 10 years of spaghetti. PHP (as of 7.2) will not be super high performance by itself, especially if http response time is your measure of performance. Symfony gives you a lot of structure backed by excellent docs but you pay the price in performance and some flexibility. For internal web apps Symfony is perfect since performance is not a high concern and the structure it gives makes maintaining the code quite easy.

The only way I have gotten PHP to be very high performance (at least with non-trivial pages) is using PHP-pm with Symfony in which I have managed to achieve around 5-10ms response time locally. Now I have not spent the time to figure out how to get rid of all of the errors with PHP-PM, so I would suggest doing your own research before considering it as an option.

Collapse
 
devmazee2057282 profile image
dewbiez

Sounds interesting. I heard that Symfony 4.1's routing system is now the fastest one available.

Collapse
 
buphmin profile image
buphmin

That is what the Symfony blog claims. Though it didn't seem like the routing was the slow part, but every millisecond counts.

Thread Thread
 
devmazee2057282 profile image
dewbiez

Yeah. It's usually the database. It's why I just use straight up PDO, I can optimize the queries themselves rather than relying on ORMs that are quite possibly inefficient.

Thread Thread
 
buphmin profile image
buphmin

Where I work we have a massive internal app which we have recently plugged Symfony into to give some much needed structure. Within the Symfony context we use a mix of ORM and raw sql. For simple select queries and insert/update we use the orm, but for more complex select queries we stick with raw sql. Our fight is maintainability and reversing all of "just get it done" code over the years.

Collapse
 
devmazee2057282 profile image
dewbiez

I wrote my own router, and I was able to get roughly 1-5ms loads, locally.

Collapse
 
alchermd profile image
John Alcher

Laravel, though Symfony is catching up as a second favorite. Granted that I work on projects that value continuous delivery over performance, Laravel's out of the box offerings is pretty much perfect.

Collapse
 
devmazee2057282 profile image
dewbiez

Laravel is really nice, but I just don't need the bulk of it. I prefer writing my own stuff.

Collapse
 
juanfrank77 profile image
Juan F Gonzalez

Honestly, I'm a novice in this arena. I tried Laravel for some time for fun projects but never had it really well. Nowadays for a whole application development I'm using the Slim framework and so far I've been liking it a lot :D

Collapse
 
devmazee2057282 profile image
dewbiez

Yeah, Laravel's pretty good. I don't know about Slim, haven't used it.

Collapse
 
juanfrank77 profile image
Juan F Gonzalez

I suggest you give Slim a shot, you can get started with something cool pretty quickly. And is not just for quick prototyping it can extend up to build a full backend application.

Collapse
 
szymach profile image
Piotr Szymaszek

Symfony. For a long time it pushed for quality while sacrificing (or not caring enough for) developer experience, but they have changed that since a year or two ago. It is progressively more easy to use and modular by nature, so you need only use the code you want to. It can be as big or as small as you need it to be.

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
devmazee2057282 profile image
dewbiez

Nice!

 
theelectricdave profile image
David S. • Edited

I think i program like you.
My code is designed to be fast, terse, mostly procedural, highly readable, with as little abstractions as possible. ( this is PHP code )

The framework i use is one i wrote and is 1000 lines long and fits in one file.

My way of developing is fast for me. Maintainable for me. I've been doing this for 10 years. Yes, it looks like php code from 2009, but it looks like DAMN good php code from 2009.

It was never a problem until i started looking for jobs and laravel and symfony terminology kept coming up in interviews. I have not been able to get another job because i am not familiar with how these jails work.

I've tried to get into symfony and laravel multiple times. It just seems like a ton more code to write and way too many layers of abstraction. It's like you're not writing php anymore.

What i don't get is how you can work in the PHP world today without putting yourself in framework jail like everyone else.

I've considered chucking my entire php skillset out the window and learning another language that isn't ran by architecture astronauts yet.

What say you?

Collapse
 
david_j_eddy profile image
David J Eddy

Yii/Yii2 is a solid framework; taking a lot of queues from Ruby on Rails and Laravel. Convention with a little configuration; modular, and pretty well documented.

Phalcon, to me, is trying to solve a problem that does not exist. Framework logic execution is very rarely the cause of an applications slowness. Network, disk, custom logic; if the app is slow, it is one of those three sources.

Collapse
 
devmazee2057282 profile image
dewbiez

Aye, usually it is. But I don't use Phalcon that much anymore. I'm either re-inventing the wheel myself, or going modular via Composer packages.

Collapse
 
david_j_eddy profile image
David J Eddy

Modular via packages is the win; I personally hate re-inventing the wheel. Most bagn for the buck (or bang per hour of effort). What has been some of the biggest problems you have run into use the modular approach?

Thread Thread
 
devmazee2057282 profile image
dewbiez

Uh, nothing much really. Probably the time it takes to setup the boilerplate. Because I'm not coming with stuff shipped out of the box for everything I need to make just about any typical web application, I have to plan what libraries I'll be using, and if it's a new one, then I have to learn it.

Although the benefits of customization for me overrules the development time. And if I get really good packages for configuration, and development(Phinx as an example for a migrations library).

To me, going modular is can be far better as I can only include what I need, and customize the project however I like. And a lot of the times it increases performance, because I'm not coming shipped with the whole set of packages when I don't need half of them.

But I still like re-inventing the wheel. I learn a lot from it, I find it fun and I might make something amazing that hasn't been invented before or something. Things are always being invented(in technology, science, etc) ... I understand if people don't like the re-inventing the wheel thing because that means they have to write it, put a lot of work into, debugging, tests, updates, etc. I don't see why we shouldn't stop inventing software.

Granted a lot of a software can just be basically re-built and slower(and just worse is general) than already existing software. If you're a "get it done and make some money" person, then it's quite perfect for you to not re-invent the wheel.

But I don't dis re-inventing the wheel, I encourage it.

 
theelectricdave profile image
David S.

It's all the dictators in php web development that make me want to jettison my 10 years of php programming skills. It seems like there's a new abstraction or practice every quarter that you must adhere to.

It just sucks all the fun out of programming. Period.

Collapse
 
devmazee2057282 profile image
dewbiez

Aye. I prefer my own code over others. Probably because I already understand it as I'm building it. I do excessive documentation. Possibly too many comments.

I also try my best to keep my classes small. And when doing dependency injection, I use interfaces instead of concrete classes, so in the future if I want, I may switch to different adapters or something like that.

Some people have given me a lot of dirt because I reinvent the wheel. :P

Collapse
 
thinsoldier profile image
thinsoldier • Edited

If you can reinvent the wheel on time within budget and bug free, don't let anyone stop you. I was not allowed to use 3rd party code for a long time and I tried reinventing just the few wheels I knew I needed. 10 years later a dozen projects are running on flat tires that are painful to change or inflate.

Thread Thread
 
devmazee2057282 profile image
dewbiez

What do you mean by "running on flat tires that are painful to change or inflate" ?

Thread Thread
 
thinsoldier profile image
thinsoldier • Edited

I mean the few components of a framework that I built were poorly built, too tightly coupled, hard to test, hard to make changes to without breaking something else unexpectedly. You speak like you have both the skill and time to make everything from scratch properly. That is great if you can. For the rest of us, a framework is a very good and necessary thing.