PHPackages                             mark-veres/bedouin - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. mark-veres/bedouin

ActiveLibrary[HTTP &amp; Networking](/categories/http)

mark-veres/bedouin
==================

A file-based PHP routing system.

1.0.1(1y ago)09PHP

Since Sep 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mark-veres/bedouin)[ Packagist](https://packagist.org/packages/mark-veres/bedouin)[ RSS](/packages/mark-veres-bedouin/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependenciesVersions (3)Used By (0)

 [![](./logo.png)](./logo.png)

bedouin
=======

[](#bedouin)

A file-based PHP routing system.

Two files:

- `cartograph.php` script that generates the map file
- `bedouin.php` script that routes according to the map file

installation
------------

[](#installation)

```
composer require mark-veres/bedouin
```

example setup
-------------

[](#example-setup)

```
# index.php
require_once "bedouin.php";

$router = new \Bedouin\Router;
$router->loadMap("map.json");
$route = $router->currentRoute();
if (isset($route->file)) include $route->file;
```

```
# gen_map.php
require_once "./cartograph.php";
$cart = new \Bedouin\Cartograph;
$cart->root_dir = __DIR__;
$cart->route_folders = ["./routes", "./api"];
$cart->printMap("map.json");
```

usage
-----

[](#usage)

- copy the `bedouin.php` and `cartograph.php` files in the desired directory
- create the `routes` and `static` directory
- create an `index.php` file will handle all requests
- redirect all requests to `index.php`
- create another PHP file that will use the cartograph API to generate the map

directory structure
-------------------

[](#directory-structure)

fileurlmethod`/routes/index.php``/`all`/routes/index.get.php``/`get`/routes/about.php``/about`all`/posts/index.php``/posts`all`/posts/[slug]/index.php``/posts/test`
`/posts/bla-bla`all`/posts/[slug]/new.post.php``/posts/test/new`post404 pages
---------

[](#404-pages)

- create a `404.php` file in the `routes` folder
- this file does not support custom HTTP methods

static files
------------

[](#static-files)

- put all your static files in the `static` directory
- access these files at the `/static/*` url
- file names are case- and extension-sensitive

accessing route parameters
--------------------------

[](#accessing-route-parameters)

- given a route `/posts/[slug]`
- and an url `/posts/test`

```
$router = new \Bedouin\Router;
// ...
print_r($router->params);
/*
  Array ( [slug] => test )
*/
```

middleware
----------

[](#middleware)

- create a file ending in `.mw.php` or `.mw.get.php` (or any HTTP method for that matter)
- the middleware will be "bound" to the index handler of the directory it is placed in

Note

coming soon:

- map splits (performance optimization when dealing with many routes)
- templates

Tip

Redirecting all requests to `bedouin.php` on an Apache server.

```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)＄ index.php
```

Tip

Redirecting all requests to `bedouin.php` with the PHP built-in server

```
php -S localhost:8080 bedouin.php
```

Tip

Regenerating the map by accessing a specific route.

```
# index.php
require_once "bedouin.php";

if ($_SERVER["REQUEST_URI"] == "/your/custom/path") {
  require_once "./cartograph.php";
  $cart = new \Bedouin\Cartograph;
  $cart->printMap("map.json");
}

$router = new \Bedouin\Router;
$router->loadMap("map.json");
$route = $router->currentRoute();
if (isset($route->file)) include $route->file;
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

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

2

Last Release

671d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/138235015?v=4)[Mark Vereș](/maintainers/mark-veres)[@mark-veres](https://github.com/mark-veres)

---

Top Contributors

[![mark-veres](https://avatars.githubusercontent.com/u/138235015?v=4)](https://github.com/mark-veres "mark-veres (18 commits)")

### Embed Badge

![Health badge](/badges/mark-veres-bedouin/health.svg)

```
[![Health](https://phpackages.com/badges/mark-veres-bedouin/health.svg)](https://phpackages.com/packages/mark-veres-bedouin)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M92](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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