PHPackages                             kohana-modules/phery - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. kohana-modules/phery

ActiveKohana-module[Parsing &amp; Serialization](/categories/parsing)

kohana-modules/phery
====================

PHP to jQuery FULL mapping, seamless ajax integration and partial rendering views

2.7.2(12y ago)10223PHPPHP &gt;=5.3.0

Since Apr 6Pushed 11y ago3 watchersCompare

[ Source](https://github.com/pocesar/phery-kohana)[ Packagist](https://packagist.org/packages/kohana-modules/phery)[ RSS](/packages/kohana-modules-phery/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (10)Used By (0)

Phery Kohana
============

[](#phery-kohana)

Kohana module with tight integration for Phery.js library

Working with AJAX (including file uploads) never been simpler. Just add the `phery.js` (like ``) file on your page (or if you are using an assets manager, add `PHERY_JS` constant to the bunch), and instead of using `Controller`, use `Phery_Controller` and instead of `Controller_Template` use `Phery_Template`.

Also, you should notice that the `$ajax` variable is available in ALL views (but you shouldn't do logic in your views though). This is mainly useful because you need to do a `` in your head, so you can install CSRF that comes enabled by default, otherwise your AJAX calls will fail (CSRF stands for `Cross Site Request Forgery` to avoid remote attacks to your AJAX forms and/or links)

For a full documentation of the phery.js library, check

Just follow these conventions:
------------------------------

[](#just-follow-these-conventions)

When you want to make a PHP function available for just one action, you namespace it:

```
class Controller_Index extends Phery_Template {

    /* This will be available for action_index only */
    public function ajax_index_edit()
    {
        return PheryResponse::factory()->alert('works for index!');
    }

    public function action_index()
    {
        $form = array(Phery::form_for('', 'edit'));
        $form[] = Form::input('id', 1, array('type' => 'hidden'));
        $form[] = Form::submit('submit', 'Send');
        $form[] = Form::close();
        $this->template->content = join('', $form);
    }

    public function action_view()
    {
        // calling phery.remote('edit') from the page won't call the phery_index_edit function
    }
}
```

When you want to reuse a callback for all actions, just don't namespace it:

```
class Controller_Index extends Phery_Template {

    /* This will be available for action_index and action_view */
    public function ajax_edit()
    {
        $r = new PheryResponse;
        /* If you must, check which action the current call should deal */

        switch ($this->request->action()):
            case 'index':
                // do according to index
                $r->alert('its for index!');
                break;
            case 'view':
                // do according to view
                $r->alert('its for view!');
                break;
        endswitch;

        return $r;
    }

    public function action_index()
    {
        $form = array(Phery::form_for('', 'edit'));
        $form[] = Form::input('id', 1, array('type' => 'hidden'));
        $form[] = Form::submit('submit', 'Send');
        $form[] = Form::close();
        $this->template->content = join('', $form);
    }

    public function action_view()
    {
        $this->template->content = Phery::link_to('Click me', 'edit', array('args' => array('id' => 1)));
    }
}
```

You may change the AJAX options per controller, by passing configuration to the `ajax` function inside your controller:

```
class Controller_Index extends Phery_Controller {

    public function ajax()
    {
        return array(
            'error_reporting' => E_ALL
        );
    }

    public function action_index()
    {
    }
}
```

Your AJAX function will be processed AFTER your `after()` function, so you can place all the transformations, cleanups, in there.

Also, inside the `Phery_Controller` or `Phery_Template`, there is the same `$ajax` variable, so you can mess with `Phery` youself:

```
class Controller_Index extends Phery_Controller {

    function action_index()
    {
        $this->ajax->set(array(
            'edit' => 'Helper::staticAjaxMethod',
            'load' => array(new Model_User, 'load')
        ));
    }
}
```

This make it highly flexible, so you don't need to be tied to convention.

If any exception happens when using AJAX, it will go 'silently' to your `application/logs` and it will fail with an empty JSON response `{}`

Coming soon
-----------

[](#coming-soon)

- Render view partial views out of the box (without having to do `$this->ajax->render_view`

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

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

Recently: every ~88 days

Total

9

Last Release

4391d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ecbe51bfdef1e9337639d2cefcb76613a0d35bb39c2c00e9a1fa6b736cb3627c?d=identicon)[pocesar](/maintainers/pocesar)

---

Top Contributors

[![pocesar](https://avatars.githubusercontent.com/u/461084?v=4)](https://github.com/pocesar "pocesar (26 commits)")

---

Tags

jsonjavascriptkohanajquerymappingajaxdelegationseamlessunobtrusive

### Embed Badge

![Health badge](/badges/kohana-modules-phery/health.svg)

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

###  Alternatives

[jquery-form/form

The jQuery Form Plugin allows you to easily and unobtrusively upgrade HTML forms to use AJAX.

5.2k235.5k6](/packages/jquery-form-form)[phery/phery

XAJAX alternative, phery.js is a library in PHP that maps to all jQuery functions, DOM manipulation, meta arguments and serialization, seamless ajax integration, RESTful emulation, form submission and partial rendering views, plus its PSR-0 compatible

13813.1k2](/packages/phery-phery)[ovidigital/js-object-to-json

PHP library to convert a JavaScript object string to JSON formatted string

18177.7k6](/packages/ovidigital-js-object-to-json)[efficiently/jquery-laravel

This package provides jQuery and the jQuery-ujs driver for your Laravel &gt;= 6 application.

1311.0k1](/packages/efficiently-jquery-laravel)[hamlet-framework/json-mapper

Json Data Binding

2711.9k](/packages/hamlet-framework-json-mapper)

PHPackages © 2026

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