Leaf PHP

Create clean, simple but powerful web apps and APIs quickly.

Leaf is a PHP micro-framework which helps you create web applications and APIs from the ground up in minutes.
Embed
Featured
discussion
Would you recommend this product?
It's simple and very easy to use
Share
Awesome, I just found about it and already using it for a client's site. Clean, well organized and the MVC versión is just great!!!
Share
Very impressive, I've starred it on Github.
Share
Mychi Darko
Maker
I'm a full stack web developer
@daniel_dewhurst thanks a lot😊
Share
this is very good simply use thanks
Share
Mychi Darko
Maker
I'm a full stack web developer
@ramesh_akshlyn 🙏🙏🙏
Share
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.
Share
Mychi Darko
Maker
I'm a full stack web developer
@marcin_tribe pls contact me at mickdd22@gmail.com😉, let's see how we can address your issue
Share
Ray Li
Mobile Developer @ NOCD Inc
@marcin_tribe PHP 7.3 is one of the fastest backends in performance benchmarks. Where did you get your results from?
Share
@rayliverified I did it myself. I have compared netty, tomcat, jetty with apache (with different modes an caches) and nginx and I was shocked. That java (with SpringBoot+built in netty, tomcat) and nodejs (with express) is much faster. I later found some similar benchmark. I was writing nice framework for PHP 7.2 and left it because I couldn't tweak empty index.php to even meet 1/10 of "java" speed. Note: I heard that "go" is like 1.2 faster than java. So from that point PHP is no go for me. And for reference: my laptop is old (Intel© Core™ i5-4300U CPU @ 1.90GHz × 2 + 16GB Ram) and I easily (Springboot+netty without any config) run 15k/sec requests (simple text response) on spring boot.
Share
Ray Li
Mobile Developer @ NOCD Inc
@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?
Share
Ray Li
Mobile Developer @ NOCD Inc
@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?
Share
ravi babuTechnology Aspirant
Will it provide me tutorials?
Share
Mychi Darko
Maker
I'm a full stack web developer
@ravi_babu1 All the information you need to create a stunning app or API is available at https://leaf-docs.netlify.com
Share
It seems extremely similar to Slim3. Why not just use Slim3?
Share
Mychi Darko
Maker
I'm a full stack web developer
@nupedrew for starters...Leaf is much simpler when compared to slim, also in terms of speed and scalability, Leaf tops Slim.
Share
@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+)?
Share
Mychi Darko
Maker
I'm a full stack web developer
@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...
Share
Mychi Darko
Maker
I'm a full stack web developer
@nupedrew Later versions are also beginning to look less like slim.....
Share
@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.
Share