From the official website:
Path is an API-first PHP framework crafted for javascript.
Path was built to work with Javascript out-of-the-box. it is more Suitable for PWA and MVC modern web apps, can also be used to build ‘just’ API for your existing App.
Path simplifies development by avoiding over-engineering and excessive abstraction.
The backbone of every application is; having a programmable interface for it, which may be consumed/used by your App or a third-party App.
To create an API you need a router that would be listening to a particular Route(or URL) and appropriate action may be taken and a response can be returned(shown) to the user.
you can listen to your preferred URL(Route) with Path’s Router, for example:
You initiate the use of the router
<?php
use PathCoreHttpRouter;
$router = new Router();
proceed to listen to a request
<?php
use PathCoreHttpRouter;
$router = new Router();
$router->get("/your/custom/route",function(){
//do something here
});
The code above does two things; the first is to listen for GET
request to /your/custom/route
(i.e., http://yourproj.dev/your/custom/route) while the second is to execute a particular function
/ class method
.
Path can also match dynamic URL as seen below
<?php
use PathCoreHttpRouter;
$router = new Router();
$router->get("/user/@id/profile",function(){
//do something here
});
Regular expressions are also a valid parameter in URL using the format shown below
<?php
use PathCoreHttpRouter;
$router = new Router();
$router->get("/user/@id:[d]+/profile",function(){
//[d]+ enforces @id to be a digit of at least one character
//do something here
});
Developer: Sulaiman Adewale
You can read more about this awesome framework at https://path.adewale.dev/