PHPackages                             aygon/jatun - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. aygon/jatun

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

aygon/jatun
===========

Jatun, a simple and convenient way to communicate between the server and client using ajax

2.0.1(9y ago)2102[2 issues](https://github.com/arnogeurts/Jatun/issues)MITPHPPHP &gt;=5.3.3

Since Oct 24Pushed 9y ago1 watchersCompare

[ Source](https://github.com/arnogeurts/Jatun)[ Packagist](https://packagist.org/packages/aygon/jatun)[ RSS](/packages/aygon-jatun/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (12)Used By (0)

Jatun Documentation
===================

[](#jatun-documentation)

This library implements a low level communication interface between your (server-side) PHP project and your (client-side) jQuery application.

Installation
------------

[](#installation)

Follow these steps to install the library in your php project. Add the following to your `composer.json` file:

```
{
    "require": {
        "aygon/jatun": "dev-master"
    }
}
```

Update the vendor libraries:

```
$ php composer.phar update
```

Application - PHP
-----------------

[](#application---php)

The Jatun environment validates and parses an array of events you want to send to the client using generic event classes. These events are encoded using an encoder (by default JSON encoder) and send to the client.

### Building the Environment

[](#building-the-environment)

The environment is the base object of the library. It handles all validation, parsing and encoding of the event array. Generic events can be added to this object to extend the support of events:

```
$env = new \Jatun\Environment()
$env->addEvent(\Jatun\Event\HtmlEvent())
$env->addEvent(\Jatun\Event\FlashmessageEvent())
...
```

### Default Events

[](#default-events)

The library already includes some basic events, in this section these events are explained:

#### Html

[](#html)

The html event adds the functionality to change the inner html of an html node based on its id.

##### Usage

[](#usage)

```
$env->addEvent(\Jatun\Event\HtmlEvent())

echo $env->parse(array(
    'html' => array(
        'id'      => 'html-node-id',
        'content' => 'new html content of the node'
    )
);
```

#### Flash message

[](#flash-message)

The flash message event adds the functionality pop up a flash message inside a html node based on its id.

##### Usage

[](#usage-1)

```
$env->addEvent(\Jatun\Event\FlashmessageEvent())

echo $env->parse(array(
    'flashmessage' => array(
        'id'                   => 'html-node-id',
        'error|notice|success' => 'the text of the flashmessage',
        [optional]
        'duration'             => 3000 // ms
    )
);
```

#### Dialog open

[](#dialog-open)

The dialog open event adds the functionality to open a jQuery dialog with a given id, title and content

##### Usage

[](#usage-2)

```
$env->addEvent(\Jatun\Event\DialogOpenEvent())

echo $env->parse(array(
    'dialog.open' => array(
        'id'       => 'dialog-id',
        'title'    => 'the title of the dialog',
        'content'  => 'the html content of the dialog',
        [optional]
        'width'    => 800, // px
        'height'   => 600  // px
    )
);
```

#### Dialog title

[](#dialog-title)

The dialog title event adds the functionality to change the title of a jQuery dialog based on its id.

##### Usage

[](#usage-3)

```
$env->addEvent(\Jatun\Event\DialogTitleEvent())

echo $env->parse(array(
    'dialog.title' => array(
        'id'       => 'dialog-id',
        'title'    => 'the title of the dialog'
    )
);
```

#### Dialog close

[](#dialog-close)

The dialog close event adds the functionality to close a jQuery dialog based on its id.

##### Usage

[](#usage-4)

```
$env->addEvent(\Jatun\Event\DialogCloseEvent())

echo $env->parse(array(
    'dialog.close' => array(
        'id'       => 'dialog-id',
    )
);
```

Application - Javascript
------------------------

[](#application---javascript)

At client side the JSON response from the server is parsed back to an array of events, which are fired sequentially, prefixed with "jatun."

In order to make the basic Jatun functionality work at client-side, jQuery, jQuery-UI and the Jatun library should be included:

```

```

In order to change click behavior on an element, or submit behavior of a form the following javascript can be used. If the selected element is not an a or form tag, Jatun tries to find a data-path attribute on the element:

```
$(selector).jatun()
```

Also a custom Jatun request can be done in the same way as a jQuery ajax request, but in this case the success handler does not have to be implemented:

```
$.jatunRequest({
   url: '/index.php',
   ...
});
```

Writing custom events
---------------------

[](#writing-custom-events)

In order to create a custom event, a

Symfony Bundle
--------------

[](#symfony-bundle)

Jatun also comes with a built in Symfony Bundle for easy integration in your Symfony project. For the Symfony bundle documentation see [bundle docs](https://github.com/arnogeurts/Jatun/blob/master/lib/Jatun/SymfonyBundle/Resources/doc/index.md)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

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

Recently: every ~369 days

Total

11

Last Release

3400d ago

Major Versions

1.0.0RC5 → 2.x-dev2012-12-30

1.1.0RC3 → 2.0.02014-12-27

### Community

Maintainers

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

---

Top Contributors

[![arnogeurts](https://avatars.githubusercontent.com/u/1117484?v=4)](https://github.com/arnogeurts "arnogeurts (45 commits)")

---

Tags

clientbundleserverajax

### Embed Badge

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

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

###  Alternatives

[phpfastcgi/speedfony-bundle

A bundle to integrate a FastCGI daemon with the symfony2 framework

909.5k](/packages/phpfastcgi-speedfony-bundle)

PHPackages © 2026

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