Hacker News new | ask | show | jobs
by georgestephanis 3830 days ago
In only 100 lines of PHP!

Requires Symfony.

3 comments

It requires Silex, a micro-framework, not Symfony. Symfony is a much larger framework that isn't required. He just used two of its modular components, Request for HTTP request parsing, and Process for spawning subprocesses.
Requiring libraries/frameworks shouldn't detract from something like this. I'd be more worried about bugs and feature support.
Nah, requiring Symfony is like requiring Django. Doesn't make much sense.
It's actually Silex. Maybe that makes more sense.
Silex is hardly a "micro framework", it's basically Symfony without the configuration files. So it's a LOT of code. I like it by the way, always hated the Spring like insanity of Symfony, but let's not pretend Silex + all Symfony libs the framework has to import are small.

The irony is that for this very project, Both Silex and Symfony\Process are completely redundant, especially with PHP bloated core APIs.

That's not correct. Silex replaces the Symfony DI (or service locator, if you will) component with something much simpler called Pimple. You can read the code within a few minutes.

The only other required libraries for Silex to function are the event dispatcher, routing (which you can swap out for something like nikic/FastRoute), and the request/response stuff. I'm not sure if you think that's a "lot" of code, but if you're rolling your own you'd probably end up using the HTTPFoundation stuff anyway.

> That's not correct. Silex replaces the Symfony DI (or service locator, if you will) component with something much simpler called Pimple. You can read the code within a few minutes.

That's exactly what I said, what is the point of your message? With Silex there is no configuration through XML or YAML. What is not correct?

But it's not requiring Symfony.
> Requires Symfony.

Silex, not Symfony, and better to rely on trusted library code than to reinvent the wheel and introduce vulnerabilities...

But it's not 100 LOC if you don't reinvent the wheel! /s