PHPackages                             alfmel/cougar - 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. alfmel/cougar

ActiveLibrary[API Development](/categories/api)

alfmel/cougar
=============

Framework for quickly developing and documenting REST APIs

213PHP

Since Jul 13Pushed 9y ago3 watchersCompare

[ Source](https://github.com/alfmel/cougar)[ Packagist](https://packagist.org/packages/alfmel/cougar)[ RSS](/packages/alfmel-cougar/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

COUGAR FRAMEWORK
================

[](#cougar-framework)

---

IMPORTANT NOTE
--------------

[](#important-note)

The Cougar Framework is dead. I no longer work for the employer who commissioned it, my old employer has not submitted any bugs or pull requests, and I am not interested in maintaining it.

I will leave the code the code here for the time being. If you are interested in the codebase, please **FORK NOW**.

END OF IMPORTANT NOTE
---------------------

[](#end-of-important-note)

The Cougar Framework is an object-oriented application framework for PHP 5.4 or above. Cougar aims to simplify the development of RESTful APIs by integrating, simplifying and optimizing security, URI routing and database access.

Cougar is not a general-purpose framework. It only focuses on making it easier to create REST Web Services. It does not have shopping carts, templeting, or much in the way of an interface.

Cougar promotes Inversion of Control (dependency injection) and Attribute- Oriented programming via annotations. For example, to publish a class method as a web service end point, you would write:

```
  class MyClass
  {
    /**
     * @Path /resource/:id
     * @Methods GET
     */
    public function myMethod($id)
    {
      // Your code here
    }
  }
```

and then plumb it together with a REST request handler as follows:

```
  $my_class = new MyClass();

  $security = new Cougar\Security\Security();
  $rest_service = new Cougar\RestService\AnnotatedRestService($security);
  $rest_service->bindFromObject($my_class);
  $rest_service->handleRequest();
```

As you can see, Cougar allows you to publish your API via REST in as little as 6 lines of code!

Cougar has been inspired by many similar micro and full frameworks such as Spring, Slim, Doctrine, Tonic and others.

Examples
--------

[](#examples)

The ZF2 Album tutorial can be written in Cougar as a REST API in 150 lines of code, complete with database connectivity, transaction control and hierarchical models. To see the code, go to the [zend\_tutorial\_in\_cougar.php](https://github.com/alfmel/zend_tutorial_in_cougar).

Tutorial
--------

[](#tutorial)

We have published a [tutorial](https://github.com/alfmel/cougar_tutorial/wiki)that walks you through the development of a Cougar-based application.

Installing Cougar
-----------------

[](#installing-cougar)

The easiest way to install Cougar is through Composer. In your project's directory, add a composer.json file:

```
{
    "require": {
        "alfmel/cougar": "dev-master"
    }
}
```

Then have composer install it for you:

```
composer.phar install
```

Cougar will be installed in the vendor directly.

Don't let the dev-master version scare you away. Cougar is developed using continuous delivery. That means it only receives small, incremental changes. Every release is tested and ready for production use.

You may also try installing via PEAR. However, PEAR is deprecated and does not contain the latest changes:

```
  pear channel-discover alfmel.github.com/pear
  pear install cougar/cougar
```

You may also clone from github and follow the instructions in INSTALL.txt:

```
  git clone https://github.com/alfmel/cougar
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/53b0e56174639f8f60766447980bcce6a99e89112f31750896a8adc1cc026000?d=identicon)[alfmel](/maintainers/alfmel)

---

Top Contributors

[![alfmel](https://avatars.githubusercontent.com/u/4806187?v=4)](https://github.com/alfmel "alfmel (125 commits)")

### Embed Badge

![Health badge](/badges/alfmel-cougar/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

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

A PHP wrapper for Twilio's API

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

GitHub API v3 client

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

PHP SDK for Facebook Business

90121.9M34](/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.1M454](/packages/google-gax)

PHPackages © 2026

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