Skip to content
Auke edited this page Jul 2, 2014 · 28 revisions
Clone this wiki locally

ARC: Ariadne Component library

There are many PHP frameworks and libraries out there. Many - if not all - implement some sort of routing system, a generic MVC ( Model-View-Controller ) pattern, dependency injection containers or service locators, some add thing like 'bundles' or 'extensions', etc.

All this is not in ARC. For one because you can get it almost everywhere else if you really need it, but more importantly it complicates things that should be really simple.

ARC is a work in progress, if you want to help, please see the Roadmap for a list of things left to do. The documentation is not complete, any help there is also appreciated.

Using ARC

You can use ARC in its entirety or just the component you need. Components are designed to be usable independent of the whole, except for a very few basic tools. Mostly these are the \arc\path component and the \arc\context component.

Install ARC using composer, e.g.:

composer create-project arc/arc my-project

This will download and install all arc components. Then load ARC in your own project like this:


        // Now just call the factory methods:

        $result = \arc\events::fire('myEvent', array( 'extra' => 'Information' ) );
        if ( $result ) {
            // do default action for myEvent

Common abstractions

This is a set of classes that abstract common datatypes and tasks.

  • arc/base
    • lambda: create lambda objects, prototypes and curried methods
    • path: parse paths, normalize them to absolute paths, etc.
    • tree: methods to parse filesystem-like trees and search and alter them
    • hash: methods to ease common tasks with nested hashes
    • template: a very basic template parser and compiler
    • context: a simple stack system that allows you to change settings for a specific context and revert them after.
  • arc/web
    • noxss: XSS intrusion detection and prevention
    • url: class to ease parsing and creation of accessible and safe url's.
    • http: simple http client.
    • html: html writer and parser ( component is temporarely removed - waiting for xml parser
  • arc/xml
    • xml: xml writer and parser ( parser is not finished yet )

Application Components

These are basic Ariadne functionalities refactored to decoupled and reusable components. The most important difference between these and similar components in other libraries is the basic support for filesystem like structuring of your application content and configuration. e.g. The event system allows events to be fired and listened to on a specific path and events will bubble up and trickle down a path. Configuration settings can be changed per path and settings will trickle down to child paths. This is a basic idiom in Ariadne, similar to what Zope, a python CMS, calls 'acquisition'.

  • arc/cache
    • cache: generic caching system and caching proxy for any other object.
  • arc/config
    • config: a configuration management system that implements acquisition.
  • arc/events
    • events: W3C style events, with a path or filesystem based capture/listen model.
  • arc/grants
    • grants: flexible path based access grants configuration and checking