PHPackages                             nabeelalihashmi/apilot-engine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. nabeelalihashmi/apilot-engine

ActiveLibrary[API Development](/categories/api)

nabeelalihashmi/apilot-engine
=============================

Simple endpoint-in-files router for PHP

v0.0.7(4y ago)1201MITPHP

Since Jan 28Pushed 4y ago1 watchersCompare

[ Source](https://github.com/nabeelalihashmi/Apilot-Engine)[ Packagist](https://packagist.org/packages/nabeelalihashmi/apilot-engine)[ RSS](/packages/nabeelalihashmi-apilot-engine/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)DependenciesVersions (4)Used By (1)

Apilot
======

[](#apilot)

Fast automatic files based router with Caching routes

[![alt text](./img/speed.png)](./img/speed.png)

### WARNING

[](#warning)

Design api carefully

Installation
------------

[](#installation)

### Using Composer

[](#using-composer)

```
    composer require nabeelalihashmi/apilot-engine

```

### Manual

[](#manual)

Just download the `Apilot.php` file, include in your project. Configure `.htaccess`.

```

```

### .htaccess files

[](#htaccess-files)

- Copy extras/root.htaccess in root folder and rename it to .htaccess.
- Copy extras/public.htaccess in public folder and rename it to .htaccess.

Routes
------

[](#routes)

Make a folder for handlers. Each file in that cockpit folder corresponds to a route.

e.g.

```
cockpit/
    index.php -> /
    about.php -> /about
    contact.php -> contact
    ...

```

Each file must have at least one handler method. The name of the method must be `handle`.

e.g.

```
    function GET() {

    }

    function POST() {

    }

    function PUT() {

    }

```

Dynamic routes
--------------

[](#dynamic-routes)

To make a route accept dynamic value, use `:` in the route.

e.g.

```
    File: cockpit/users/:id/edit.php
    URI: /users/:id/edit

    function GET($id) {
        ...
    }
s
    File: cockpit/users/:id/:action.php
    URI: /users/:id/:action

    function GET($id, $action) {
        ...
    }

```

Optional Parameters
-------------------

[](#optional-parameters)

To make a route optional, make the parameter optional with `?`.

```
    File: cockpit/list/:page?.php
    URI: /list/:page?

    function GET($page = 1) {
        ...
    }

```

Rules
-----

[](#rules)

- Optional Routes must place at end

```
hello/:who? Good
hello/:who?/level2 Bad
hello/:who?/level2 Bad

```

Middleware
----------

[](#middleware)

You can use middleware to do something before and after the route. You can use `before` and `after` appended to handler method name. before middleware must return true to continue.

```
function GET() {

}

function before_GET() {
    return true;
}

function after_GET() {

}

```

Route Not Found
---------------

[](#route-not-found)

Apilot will call the `on404` function if the route is not found. You can use this function to redirect to 404 page or do something else.

usage:

```
$apilot->on404(function() {
    ...
});

```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

1561d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/449341cf2d2c255eeaa52f06da4293fdcf2f407b10984846b6c130418c7b4eab?d=identicon)[nabeelalihashmi](/maintainers/nabeelalihashmi)

---

Top Contributors

[![nabeelalihashmi](https://avatars.githubusercontent.com/u/14184842?v=4)](https://github.com/nabeelalihashmi "nabeelalihashmi (9 commits)")

---

Tags

phpphp-libraryphp-routerphp-router-standalonephp-routing

### Embed Badge

![Health badge](/badges/nabeelalihashmi-apilot-engine/health.svg)

```
[![Health](https://phpackages.com/badges/nabeelalihashmi-apilot-engine/health.svg)](https://phpackages.com/packages/nabeelalihashmi-apilot-engine)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M33](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
