Download the PHP package aol/atc without Composer

On this page you can find all versions of the php package aol/atc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package atc

ATC, An Action-Based PHP Dispatching Library

Build Status Latest Stable Version Latest Unstable Version Total Downloads Code Climate

ATC is a small dispatching library for PHP built on Aura.Router package and Symfony's HttpFoundation and EventDispatcher. There are two things you should know about this library:

  1. Every single route matches to a single Action class.
  2. Exceptions thrown from the Action can implement the ActionInterface and become the new Action.

"What's an action?" You can think of an Action as a Controller with a single method. Rather than being responsible for many different routes/pages it is only responsible for a single route.

Usage

The simplest possible way to use ATC is by just setting up a route and a corresponding action. Lets do a simple hello world for our home page with an Action called Index.

Now any requests for the home page / will match the Index Action and send a "Hello world" back to the browser. Remember, this is just using Aura.Router so its pretty easy to build complex paths with named parameters.

Leveraging the presenter

While the method above would be great for simple API responses often you need to be able to do more complex things with templating libraries. ATC will always evaluate the return value of your Action and if it is a Symfony response object it will just send it straight to the browser. If it is not a response object it will take that data and hand it off to the Presenter to handle formatting.

There is an interface for the Presenter class - which makes it very easy to drop in your templating package of choice - but out of the box ATC will handle JSON responses and basic PHP templates. By default it will render the HTML template, but if the request header for the content type is set to application/json it will send the json encoded version of your action response. You can always lock an Action down to a single response type by setting the $allowed_formats property.

Exceptions can be Actions too

Any exception thrown from an ATC Action can immediately replace the current Action as long as implements the ActionInterface. Yep, you read that correctly, exceptions can be actions too. For example, if you throw the NotAuthorizedException from your Action the dispatcher will verify the exception implements the ActionInterface and then redispatch the request using the exception action. In this case it will respond with a 401 HTTP response code and look for a errors/401 template to use in the presenter.

You could also create custom exceptions within your own application. For example you could have a NotSignedInException that returns a RedirectResponse to the signin page:

The flexibility is unparalleled and the possibilities are endless.

Setup

The dispatch class itself can be instantiated with just a few dependencies.

Installing via Composer

ATC supports PHP 5.4 or above. The recommended way to install ATC is through Composer.

Next, run the Composer command to install the latest stable version of ATC:

After installing, you need to require Composer's autoloader:

FAQ

WTF is "ATC"? It originally stood for "Air Traffic Control" but that's a lot of typing and doesn't roll off the tongue very well.

How do I inject dependencies into my Action classes? The included ActionFactory is just the bare bones, but you can inject your own factory into the Dispatcher as long as it implements the ActionFactoryInterface.

What about Twig/Smarty/Blade/etc? Like the ActionFactory you can inject your own presenter class into the dispatcher as well as long as it implements the PresenterInterface. There are a lot of possibilities here so if you do something cool let us know!

I think I found a bug, now what? Please, open up an issue! Make sure you tell us what you expected, what happened instead, and include just enough code so that we can reproduce the issue.

Will you add feature X? Maybe, but you'll never know until you ask. Open up an issue and we'll discuss it and if you're interested in submitting a pull request check out the Contributing section below.

Contributing

ATC is an open source project and pull requests are welcome if you'd like to contribute. Please include full unit test coverage and any relevant documentation updates with your PR.

License

ATC is licensed under the MIT License - see the LICENSE file for details


All versions of atc with dependencies

PHP Build Version
Package Version
Requires aura/accept Version ~2.0
aura/router Version ~2.0
psr/log Version ~1.0
symfony/http-foundation Version ~2.5
symfony/event-dispatcher Version ~2.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aol/atc contains the following files

Loading the files please wait ....