A web service development kit for communicating with the Auja javascript frontend. Auja is an easy-to-use, easy-to-implement admin interface for managing your data.

v3.0.0-alpha19 2015-11-20 18:52 UTC



This repo will no longer be maintained and will be deleted in the start of 2017.


Build Status Coverage Status Dependency Status Latest Stable Version Total Downloads Latest Unstable Version

Auja is an easy-to-use, easy-to-implement admin interface. It provides an easy and intuitive way for you to view and manipulate your data, so you can focus on more important matters. Auja is designed to be both user-friendly and developer-friendly by providing you with tools to setup your admin interface in a couple of minutes.

The Auja javascript frontend provides the graphical user interface. To determine its content, it relies on a JSON web-service you implement. This repository in turn, provides an Object Oriented approach to provide these JSON messages from a PHP application.

Related repositories

  • Auja - The frontend JavaScript GUI
  • Auja for Laravel - An implementation of Auja for the Laravel framework


Auja-PHP is available on Packagist. Add Auja-PHP to your dependencies by running

composer require label305/auja:v3.0.0-alpha5


Auja uses three main types:

Each of these classes have implemented the __toString() method which returns valid JSON, accepted by the Auja JavaScript implementation.


The Label305\Auja\Main\Main class is used to define the main view of Auja. The following example will tell Auja to create a logout button, and add a single model item. It also adds an authentication form:

$main = new Main();

$main->setTitle('My Application');
$main->setColor(Main::COLOR_MAIN, '#22bcb9');

/* Add a logout button. */
$logoutButton = new Button();

/* Add a model. */
$item = new Item();

/* Add an authentication form. */
$authenticationForm = new Form();

    /* Add a username text field. */
    $usernameTextFormItem = new TextFormItem();
    /* Add a password field. */
    $passwordFormItem = new PasswordFormItem();
    /* Add a submit button. */
    $submitFormItem = new SubmitFormItem();


return $main;


The Label305\Auja\Menu\Menu class is used to define the menus in Auja. The following example creates a menu for the Club model:

$menu = new Menu();

/* Add a link item to add a club. */
$addMenuItem = new LinkMenuItem();

/* Add a spacer. */
$spacerMenuItem = new SpacerMenuItem();

/* Add a placeholder for showing a list of clubs. */
$resourceMenuItem = new ResourceMenuItem();

return $menu;

As you can see, three MenuItem types are used:

  • LinkMenuItem - represents a simple link to another menu or page;
  • SpacerMenuItem - represents a simple text label;
  • ResourceMenuItem - represents a collection of resources.

The ResourceMenuItem is a placeholder for the actual items to show. When its target url is called, Auja expects a Label305\Auja\Menu\Resource object, containing a list of entries:

$resource = new Resource();

/* Add Manchester United to the list. */
$item = new LinkMenuItem();
    ->setName('Manchester United')

/* Add FC Bayern Munchen to the list. */
$item = new LinkMenuItem();
    ->setName('FC Bayern München')

/* Provide a url to the next page of clubs. */

return $resource;


A page, defined by Label305\Auja\Page\Page, represents a panel to view and modify a single entry. The following example creates an edit page for the Club model:

/* Retrieve the Club instance. */
$club = ...;

$page = new Page();

/* Add a header with a delete button. */
$pageHeader = new PageHeader();
$pageHeader->setText('Edit Club');

$deleteButton = new Button();
    ->setConfirmationMessage('Are you sure?')


/* Add the form. */
$form = new Form();

    /* Add a name text field.  */
    $nameFormItem = new TextFormItem();
    /* Add a submit button. */
    $submitFormItem = new SubmitFormItem();
return $page;


To start developing for Auja-PHP, do the following:

  • Clone the project;
  • Run composer install.

To run PhpSpec, execute bin/phpspec run.
If you want to run code coverage locally, you need to execute the following:

  • composer require henrikbjorn/phpspec-code-coverage:~0.2 satooshi/php-coveralls:~0.6
  • printf "\nextensions:\n - PhpSpec\\\\Extension\CodeCoverageExtension" >> phpspec.yml

Do not commit these changes!


Copyright 2014 Label305 B.V.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.