PHPackages                             hydra/hydra - 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. hydra/hydra

ActiveLibrary[Framework](/categories/framework)

hydra/hydra
===========

The cozy RESTfull PHP5.3 micro-framework.

19352[1 issues](https://github.com/z7/hydra/issues)PHP

Since Oct 18Pushed 11y ago3 watchersCompare

[ Source](https://github.com/z7/hydra)[ Packagist](https://packagist.org/packages/hydra/hydra)[ RSS](/packages/hydra-hydra/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Hydra
=====

[](#hydra)

The cozy RESTfull PHP5.3 micro-framework.

- [Homepage](http://sandulungu.github.com/hydra)
- [Application template](https://github.com/z7/hydra_app)

Requirements
------------

[](#requirements)

- Http server (Apache 2 with "AllowOverride All" recommended)
- PHP 5.3

Getting started
---------------

[](#getting-started)

1. Download the [default application template](https://github.com/z7/hydra_app/zipball/master).
2. Extract it somewhere in your Apache web folder, for example in *hydra\_app*. Make sure the application is able to create **data** and **hydra** subfolders.
3. Insert the following lines in **web/index.php** just before `$app->run();`

```
$app->route('GET', 'hello/%name', function($name) {
  return "Hello, $name!";
});
```

Open [http://localhost/hydra\_app/hello/John](http://localhost/hydra_app/hello/John) in your browser to see execution result.

See our [wiki](https://github.com/z7/hydra/wiki) for more [usage samples](https://github.com/z7/hydra/wiki/Samples).

Features
--------

[](#features)

- **Strong security**: XSS, click-jacking, CSRF and code injection protection. Form and request data normalization.
- **Router** with support for both, callback and **controller** classes (using annotations).
- JSON and HTML **data dumping** for super-quick web-service prototyping.
- **Form builder** with guessers, allowing to directly edit any data with just one `$app->form(array('data' => $data))` call.
- **Service container**, including with the possibility to inject both services and factories (properties and methods) and extend/overwrite/unset them at run-time. No more problems with extending core classes.
- **Hooking system** with intuitive execution flow control (weighted hooks) and auto-scanning of plugin hook files.
- Sample service implementations on the example of **MongoDB** and **PDO** classes.
- **Caching** - to run even faster when in production.
- Simple **Requests/Response** workflow with ability to stream content; hooks at every step of the flow with interruption abilities.
- **Session**, **Cookies** and **Persistent Configuration** - just set a property/value in these array-access enabled services and it will be there on subsequent request. Or you can use the IDE auto-completed object access syntax for known properties. Almost magic!
- [Twig](http://twig.sensiolabs.org/). Of course you can make your own PHP templates or even a template engine, but first, take a look at what Twig has to offer.
- [Monolog](https://github.com/Seldaek/monolog) **logging** + FirePHP/ChromePHP support + Symfony's **Exceptions handler** with debug/production presets = easy debugging.
- Extremely friendly with IDEs. All services and dynamic methods support auto-completion.
- Clean UI created using [Twitter Bootstrap](http://twitter.github.com/bootstrap/).
- Distributed in source code, as standalone **phar** and the [hydra/hydra](https://packagist.org/packages/hydra/hydra) **composer package**.

Why yet another framework?
--------------------------

[](#why-yet-another-framework)

I want to break some PHP stereotypes just like John Resig did with jQuery in the JavaScript world.

Hydra's concept was born during the prototyping of several REST applications. Initially I used Silex. At that moment I thought it was a very good micro-framework to quickly wire-up the RESTfull routes with some MongoDB and PDO code. Some time later it was obvious that, while the closures and route patterns were nice and cool, the service container wasn't that intuitive and powerful after all. No IDE auto-completion for services, strange syntax, bloated functionality providers, it didn't just work out-of-the-box like I wanted it to. Another thing, I noticed was the slowdowns determined by the missing of a caching routine and heavy components architecture, while I only needed basic IO, mostly already provided natively by PHP. Of course, there were nice concepts you'll find in Hydra as well...

My conclusion was that most of the frameworks, even tiny ones give too much attention to classical OOP patterns, while not taking advantage of some of the best things PHP has to offer. Some are over-bloated by reinventing better implementations of standard features that are already available in PHP. While there are some exceptions, most of them give very small added value while slowing things down. In the end it seemed less time consuming to just take the good components (like theming, logging, error handling) from the best players out there and rethink only the core to be thinner and more flexible.

Ingredients used:

- [Symfony Components](http://symfony.com/components) (Error/Exception Handlers, MimeType guessers)
- [Twig](http://twig.sensiolabs.org/)
- [Twitter Bootstrap](http://twitter.github.com/bootstrap/)
- [Monolog](https://github.com/Seldaek/monolog)

Why you called it "Hydra"?
--------------------------

[](#why-you-called-it-hydra)

Because of the vision. A hydra (mythological creature) can grow heads dynamically.

We tried to apply this ad-hock growing to OOP. Until version 5.3 this was harder to achieve and before 5.0 impossible at all. Now, that we've got magic methods, closures, SPL and the classical interpreter features we had the opportunity to combine them all into a very flexible, yet simple dependency injection system. It's the cool run-time objects morphing brought to a new level.

Contributing
------------

[](#contributing)

Hydra is right now in an early stage of development, so your feedback is VERY, VERY important. Share, discuss, post issues and feature requests, write review. The best has yet to come!

If you want to contribute source code, please [leave a message in the tracker](https://github.com/z7/hydra/issues/new) or write directly to .

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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/2af94026f7f4f4fda3e8b7cb68a7cf60d1544befc629630765c0c99853f64633?d=identicon)[z7](/maintainers/z7)

---

Top Contributors

[![sandulungu](https://avatars.githubusercontent.com/u/196155?v=4)](https://github.com/sandulungu "sandulungu (13 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (1 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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