PHP Framework ‘Path’ developed by a Nigerian

PHP Framework ‘Path’ developed by a Nigerian

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

<pre><code><?php

use PathCoreHttpRouter;

$router = new Router();

 

proceed to listen to a request

<pre><code><?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://project.dev/your/custom/route) while the second is to execute a particular function / class method.

Path can also match dynamic URL as seen below

 <pre><code><?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

 <pre><code><?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/