it is sad but from my perspective php is doom. Major issue is the speed of development and language performance. only 1k/s requessts with index.php and "echo" but when using java (Spring) or nodeJs i get 15k and 5k.
@marcin_tribe In my personal benchmarks, I find that I'm limited to 120 requests per second with PHP.
There's some interesting benchmark stats here: https://www.toptal.com/back-end/...https://thinkmobiles.com/blog/ph...
I've been doing Android development for 8+ years but never used Java for a backend. Can you run a Loader.io and tell me how many requests Spring MVC is able to handle?
@marcin_tribe Here's the best article I've found with real world server results: https://medium.com/@mihaigeorge....
You're right about PHP's RPS. I'm still very skeptical about the performance of other platforms. Are they really that much faster than PHP?
@mychi_darko I see.
When I first looked at the code, it seemed to be so similar that it seemed to be copied.
I reviewed the code on the Leaf and Slim homepages:
https://leaf-docs.netlify.com // Slim http://www.slimframework.com
require_once __DIR__ . '/vendor/autoload.php'; // Slim require __DIR__ . '/../vendor/autoload.php';
$leaf = new Leaf\Core\Leaf(); // Slim use Slim\Factory\AppFactory; Slim $app = AppFactory::create();
$response = new Leaf\Core\Response(); // Slim use Psr\Http\Message\ResponseInterface as Response;
$request = new Leaf\Core\Request(); // Slim use Psr\Http\Message\ServerRequestInterface as Request;
// Leaf
$leaf->post('/books/add', function() use($request, $response) {
$title = $request->getParam('title');
echo $response->respond(["message" => "hello"]);
});
// Slim
$app->get('/hello/{name}', function (Request $request, Response $response, array $args) {
$name = $args['name'];
$response->getBody()->write("Hello, $name");
return $response;
});
$leaf->run(); // Slim $app->run();
Next, I took a much closer look the libraries and the evolution of Slim.
I speculate that once Leaf has over 5 years of existence, over 100 contributors, and "the rest" of the code is filled in, and "the rest" of the best practices, it will look more like Slim. Are you just going to limit the code and functionality?
I'm not sure scalability is an issue with Slim. It's a dependency of SuiteCRM.
Can you give an example of how Slim impairs scalability?
I'm not sure speed is a concern with regard to PHP micro-frameworks in most use cases. Do you believe that if both Slim and Leaf were set up on a free shared host, for example, that the response would be dramatically different? Is "faster" merely a matter of reducing the lines of code? When developers add "the rest" of the code by including composer libraries or writing it themselves, do you believe the speed will still be faster?
What use case do you have in mind where speed matters (in the context of PHP 7+)?
@nupedrew lol, the code looks quite similar because Slim was a major inspiration for Leaf. In terms of speed, I guess you're right about it not being a deciding factor...also, Leaf has a lot of "unique code", so it's not just some rip off of Slim...
@mychi_darko
How will Leaf be less like Slim (especially starting from code that is so similar to Slim)?
I would guess that as you get more contributors, they will want similar features to Slim and "pull" (pun intended) the codebase in that direction. How will you govern the project so that it is different than Slim? When I review the code of Slim, I don't see much there that is objectionable. What philosophy / vision will force Leaf to be "not-Slim"?
I also believe that Slim will slowly grow in size and functionality.
I am interested in vision of Leaf, in part, because I am developing a microframework. It's in PHP but not competitive or similar to Leaf or Slim. However, I review the code of microframeworks for inspiration.
I use Slim (at least because I use SuiteCRM). ;)
I could see using (and contributing to) Leaf in the future as well.
However, I must be able to defend the choice to use a lesser-known microservice.