An open API service indexing awesome lists of open source software.

https://github.com/krolow/cobaiaannotation

Annotations in CakePHP
https://github.com/krolow/cobaiaannotation

Last synced: 2 months ago
JSON representation

Annotations in CakePHP

Awesome Lists containing this project

README

        

CobaiaAnnotation
================

Annotations in CakePHP.

## Why?

- Because Annotations are cool!
- Because We like (or at least I like)
- Because no make sense repeate over and over the same code in PHP
- Use PHP array to configure is sux
- Metadata and Metaprogramming are cool!

## Installing

CobaiaAnnotations make usage of composer, so download composer and create your app/composer.json

```javascript
{
"name": "testing",
"require": {
"php": ">=5.3.0",
"cakephp/debug_kit" : "*",
"cobaia/cobaia-annotation": "dev-master"
},
"minimum-stability": "dev"
}
```

It's time to running composer.phar install

After install it's time to load the plugin, open app/Config/bootstrap.php

```php
CakePlugin::load('CobaiaAnnotation', array('bootstrap' => true));

//register filter
Configure::write('Dispatcher.filters', array(
'AssetDispatcher',
'CacheDispatcher',
'CobaiaAnnotation.AnnotationDispatcher'
));
```

## What annotations do we have in CobaiaAnnotation?

### @ParamConverter

```php
Content->read(null, $content);
```

### @ViewHandler

```php
$this->layout, $this->render(), just define in the annotation what layout you want to use and also what view, and that's it.

It makes also inheritance so if you define one layout or view in the class DocBlock, the actions will inherit the value.

### @ModelLoader, @ComponentLoader, @HelperLoader

```php
The MIT License
Redistributions of files must retain the above copyright notice.

## Author

Vinícius Krolow - krolow[at]gmail.com