PHPackages                             saturn/taurus - 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. [Framework](/categories/framework)
4. /
5. saturn/taurus

ActiveLibrary[Framework](/categories/framework)

saturn/taurus
=============

Small API Platform

1.1.2(10y ago)019GPL-2.0PHPPHP &gt;=5.3.0

Since Dec 30Pushed 10y ago1 watchersCompare

[ Source](https://github.com/pkrll/Taurus)[ Packagist](https://packagist.org/packages/saturn/taurus)[ Docs](https://github.com/pkrll/Taurus)[ RSS](/packages/saturn-taurus/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

Taurus [![Latest Stable Version](https://camo.githubusercontent.com/f31cd9e4b14e12c871e933b38f7067511f18d291d0c60955ec372bf112b8af57/68747470733a2f2f706f7365722e707567782e6f72672f73617475726e2f7461757275732f762f737461626c65)](https://packagist.org/packages/saturn/taurus) [![License](https://camo.githubusercontent.com/b72b351a841a177368df595e8174b34684df34f5ad11102cc8045c73b6b3e8e4/68747470733a2f2f706f7365722e707567782e6f72672f73617475726e2f7461757275732f6c6963656e7365)](https://packagist.org/packages/saturn/taurus)
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#taurus--)

A simple, small, easy, etcetera, API framework.

### Installation

[](#installation)

##### With Composer (recommended):

[](#with-composer-recommended)

```
$ composer require saturn/taurus
```

##### Setup

[](#setup)

Add a .htaccess file to your root directory, to redirect all requests to the file that should launch Taurus, for example:

```
Options -Indexes
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_METHOD} ^(get|post)$ [NC]
RewriteRule ^ index.php [QSA,L]

```

Create a folder named `application` at root level. This folder will contain the API(s). The API folder must be named after it's version.

The folder structure should look something like this:

```
- application/
   - 1.0/
     - Resources/
        + Example.php      // The end point
     - Models/
        + ExampleModel.php // The Model file for Example (optional)
     - BaseAPI.php (Each API version must extend the Base API class.)
   - 1.1/
     - Resources/
     - Models/
     - BaseAPI.php
- index.php
- .htaccess

```

### Usage

[](#usage)

Run Taurus in your `index.php` file.

```
use taurus\core\Taurus;

include "vendor/autoload.php";

try {
    new Taurus();
} catch (Exception $e) {
    // Error handling
}
```

Each API version must extend the BaseAPI class.

```
// Add it to the API version's base folder, i.e. /application/1.0/BaseAPI.php
use taurus\core\BaseAPI;

class API extends BaseAPI {

}
```

To actually start using Taurus, you need to create `Resources` with end points.

#### Create Resources &amp; End Points

[](#create-resources--end-points)

All resources should be put inside the `Resources` folder in the appropriate API folder under `application`. The Resource classes must extend the base class `Resource` and have a `main` method (this is the default method called).

Below follows an example on how to create an end point named `Example` with two end points: Main (`/`) and remove.

```
// /application/1.0/Resources/Example.php
// This end point is accessible by calling: http://api.example.dev/1.0/Example or:
//                                          http://api.example.dev/1.0/Example/remove/15
use taurus\core\Resource;

class Example extends Resource {

    protected function main() {
        $data = $this->model->getExamples($id);

        if (isset($data["error"])) {
            $data = $data["error"];
            $this->statusCode = 500;
        }

        $this->response($data, $this->statusCode);
    }

    protected function remove() {
        $id = $this->arguments[0];

        if (isset($id)) {
            $response = $this->model->deleteExample($id);
            $this->statusCode = 200;
        } else {
            $response = "No id given";
            $this->statusCode = 400;
        }

        $this->response($response, $this->statusCode);
    }

}
```

#### Create Models for your Resources

[](#create-models-for-your-resources)

All business logic should be put inside a model class. Models must be paired with exactly one resource file and have the same name, followed by "Model", and extend the base model class `Model`.

Taurus includes a database wrapper class, accessible through the class property database defined in `Model`. See [Database](https://github.com/pkrll/Database) for more information on how to use the database connection.

To connect to the database, you must first define and set the following constants in your config file:

- `kHostname`: The hostname on which the database server resides.
- `kDatabase`: The name of the database.
- `kUsername`: The username.
- `kPassword`: The password.

Below is an example on how to use a model, based on the example above.

```
// /application/1.0/Resources/ExampleModel.php
use taurus\core\Model;

class ExampleModel extends Model {

    public function getExamples() {
        $query = "SELECT name FROM Examples";
        return $this->database->read($query);
    }

    public function deleteExample($id) {
        $query = "DELETE FROM Examples WHERE id = :id";
        $param = array("id"  => $id);

        $response = $this->database->write($query, $param);

        return $response;
    }

}
```

Author
------

[](#author)

Taurus was created by Ardalan Samimi.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~7 days

Total

6

Last Release

3792d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/140205?v=4)[Ardalan Samimi](/maintainers/pkrll)[@pkrll](https://github.com/pkrll)

---

Top Contributors

[![pkrll](https://avatars.githubusercontent.com/u/140205?v=4)](https://github.com/pkrll "pkrll (10 commits)")

---

Tags

apiframeworkTaurus

### Embed Badge

![Health badge](/badges/saturn-taurus/health.svg)

```
[![Health](https://phpackages.com/badges/saturn-taurus/health.svg)](https://phpackages.com/packages/saturn-taurus)
```

###  Alternatives

[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

42.9k337.6k1](/packages/ccxt-ccxt)[lanin/laravel-api-debugger

Easily debug your JSON API.

2311.8M1](/packages/lanin-laravel-api-debugger)[gotzmann/comet

Modern PHP framework for building blazing fast REST APIs and microservices

68316.2k1](/packages/gotzmann-comet)[psx/psx

PHP REST API Framework

17112.6k3](/packages/psx-psx)[abydahana/aksara

Aksara is a CodeIgniter based CRUD Toolkit you can use to build complex applications become shorter, secure and more reliable just in a few lines of code. Serving both CMS or Framework, produce both HEADLESS (RESTful API) or TRADITIONAL (Browser Based), just by writing single controller. Yet it's reusable, scalable and ready to use!

1111.2k](/packages/abydahana-aksara)

PHPackages © 2026

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