6 ms·
> This is absolutely not the case, and you know it. Almost every language has a wealth of HTTP tools and frameworks, and many of them come built-in. Lots of la
by AegirLeet 6y ago
> This is absolutely not the case, and you know it. Almost every language has a wealth of HTTP tools and frameworks, and many of them come built-in.
Lots of languages have HTTP tools and frameworks, but not many of them are even comparable in scope to Symfony or Laravel. Out of curiosity, can anyone point me at some frameworks in other languages that have the following things built-in?
* Route matching and dispatch
* URL generation (generate a URL for some route) including signed and temporary URLs
* Middlewares
* Abstractions for dealing with incoming HTTP requests (getting headers, body, uploaded files etc.)
* Abstractions for creating and sending HTTP responses (headers, body etc.)
* CSRF protection
* Database drivers for a couple of backends (MySQL, PostgreSQL, SQLite etc.)
* Database migrations
* Database seeding
* Views/HTML rendering
* Logging capabilities (configurable backends like rotating log files, syslog, Slack etc.)
* Sessions with different storage backends (filesystem, Redis etc.)
* Request validation ("this field is required, has to be a string, between x and y characters long" etc.)
* Translation and localization
* Broadcasting through WebSockets
* Caching with a couple of backends (filesystem, database, Redis etc.)
* Email sending with a couple of backends (SMTP, Mailgun, SES etc.)
* Notifications with different channels (Email, SMS etc.) and backends (SMTP, Mailgun, Twilio etc.)
* Job queues with different backends (database, Redis, SQS etc.)
* Scheduled jobs
* Authentication (different flavors like regular sessions, API tokens etc.)
* Authorization
* Hashing
* Encryption
* Query builder
* ORM with relations between objects, JSON serialization etc.
* CLI commands with option/argument parsing, colored output, progress bars etc.
* Events, including async handling of events
* File storage with a couple of backends (local filesystem, S3 etc.)
* Pagination
* Payment integration
* Full text search with different backends (database, Algolia etc.)
This is basically the feature set of Laravel, I probably missed some things too.
And I don't mean "oh yeah I'm sure there's a library for that" - I mean fully integrated, first-party, tested, dead simple to use and available by default.
Maybe I'm wrong, but I seriously doubt this just exists in any language.
- echelon 6y agoRuby on Rails. Django. Revel. Actix.
- camjw 6y agoDoes Actix really have all this stuff? Signed/temporary URLs for instance? Never used it so just interested.
- AegirLeet 6y agoRoR and Django are probably the closest (Laravel was inspired by RoR). Still, I don't think they support all those features. Like I can't find any official RoR support for payments, full text search, encryption, pagination, scheduled tasks or building CLI commands. With Django, full text search seems limited. It supports PostgreSQL, but I couldn't find first-party integration for Algolia, Solr, Elasticsearch etc. or a generic way to add backends (pluggable drivers) for them. There's support for WebSockets through Django Channels, but it seems a lot more basic than Laravel's broadcasting system. No official support for queued jobs or schedules? Revel doesn't seem to have support for building CLI commands, encryption, emails, pagination etc. Apparently, any kind of database access or ORM isn't even first-party? The inclusion of Actix in this list confuses me. From what I understand, Actix isn't a web framework at all, it's more like a foundation for using the actor model. (I didn't exhaustively analyze everything, there's certainly more things missing from some of those frameworks)
- mywittyname 6y agoPython has an Elasticsearch API available as a package, which is probably why it's not packaged in with Django.
- fernandotakai 6y agoalso, wtf payment integration? if i need payment integration, there are myriad of libraries to chose. i don't need my web framework to decide that for me.
- joelbluminator 6y agoWhy would RoR bake payments support into the framework? RoR is there to tackle common web application tasks, payments is there for maybe 30% of web apps / services. There's an active debate on what popular libraries should be included in Rails, and all the features you listed can be found in libraries if they aren't in Rails already.
- akie 6y agoYou have to understand, all of that is irrelevant! Because PHP is old and shitty, it mixes camel_case and SnakeCase and the order of arguments in the standard library is inconsistent! Bah.
- zoomablemind 6y agocamelCase and snake_case ... Just to avoid confusion
- mercer 6y agoIt made me giggle, which I assume was the point.
- onli 6y agoRails should match that, if you accept that a small part of the feature list is provided by (popular and commonly used) plugins.
- AegirLeet 6y agoYes, as mentioned in my other reply, I think Rails is probably the closest competitor and can do most (although not everything) of what Laravel can. Django is the third option I think comes very close. Admittedly, limiting the selection to first-party code might be a bit unfair to frameworks that maybe simply rely more on community-built extensions, but I have to draw the line somewhere, otherwise I guess every framework theoretically "supports" everything through some third-party module that may or may not work ;)
- twhitmore 6y agoSpring Boot has most of the important parts of this. And super easy to call a library for anything else, or write 10-20 lines of code yourself. This is all in a performant, reliable and secure compiled language (Java). Language improvements and modern frameworks have also addressed the long-winded code which used to be an issue.
- ragnese 6y ago> Language improvements A.k.a., Kotlin. :p In all seriousness, though. The only thing PHP still has over Java is that when I say my function takes Foo type, you can't give it null instead.
- sigzero 6y agoMojolicious (Perl) has just about all those things. It's been a while since I've looked at it.
- marcosdumay 6y agoWhat do those mean? > Hashing > Encryption > CLI commands with option/argument parsing, colored output, progress bars etc. (Do you mean a management console? All of them have it.) Except for those, Django has every single one.
- AegirLeet 6y agoHashing: Support for securely creating and verifying cryptographic hashes, like you'd need for password hashing. Encryption: Support for securely encrypting, signing, decrypting and verifying arbitrary payloads. In Laravel, you can do: $plaintext = 'foobar'; $encrypted = $encrypter->encrypt($plaintext); // this will encrypt the plain text, generate a MAC and combine everything into a base64 encoded payload $decrypted = $encrypter->decrypt($encrypted); // this will decode the payload, verify its MAC and decrypt it, giving you back the original plain text $decrypted === $plaintext; // true As for CLI commands, I meant the ability to easily create your own commands. Here's [1] the relevant Laravel docs, for example. You can create commands and they will have access to all the things you can use in a HTTP context too, other than the actual HTTP stuff like the current HTTP request, because there obviously isn't one. So, for example, you could write a command that would use the ORM to perform some maintenance tasks on your database. [1]: https://laravel.com/docs/7.x/artisan https://laravel.com/docs/7.x/artisan
- marcosdumay 6y agoYou mean, an crypto library exported by the framework instead of you specifically importing it? I don't see the gain (as a consequence, I have no idea if other frameworks do that). RoR and Django both have extensible management commands, and all frameworks that I have ever seen allow you to create independent CLI commands (it's on PHP that the CLI is a second class citizen).
- AegirLeet 6y agoI think having good, secure, easy to use and hard to misuse crypto makes a ton of sense for any framework. The framework needs these internally anyway (to offer encrypted sessions for example), so you might as well expose them to the developer too. I might have missed it, but I couldn't find any documentation on how to create custom commands in RoR. For Django I found [1] (through "python manage.py" from what I understand) and that does look like it's more or less the same as Laravel's "php artisan", with commands provided by the framework as well as the ability to add your own. Anyway, I wasn't trying to attack RoR or Django, as those are actually the best alternatives to Laravel I know of. I worked on an existing Django project for a bit and while I don't like Python, Django seemed just fine to me for the most part. I did want to express my disagreement when it comes to the original claim of "any framework in any language can do what PHP frameworks can do" though. [1]: https://docs.djangoproject.com/en/3.0/howto/custom-management-commands/ https://docs.djangoproject.com/en/3.0/howto/custom-managemen...