smiler/autumn

php annotation mvc

dev-master 2017-07-18 03:36 UTC

This package is not auto-updated.

Last update: 2024-04-19 17:49:56 UTC


README

php annotation mvc

Installation

Install the latest version with

$ composer require smiler/autumn

Basic Usage

<?php

/**
 * @controller
 * @path ("/hw")
 */
class HelloWorld
{

    /**
     * @autowired ({"name":"hello_world"})
     */
    private $helloWorldModel;

    /**
     * @route({"method":["GET","POST"],"path":"/"})
     */
    public function doSomething1()
    {
        $this->helloWorldModel->execute();
    }
}

<?php
/**
 * @model (hello_world)
 */
class HelloWorldModel
{

    /**
     * @database ({"name":"source_name"})
     */
    private $db;

    public function execute()
    {
        echo 345677;
    }
}

Attention

the name of php file must be equals to the class name,eg.

HelloWorld.php

class HelloWorld{}

Documentation

Requirements

  • PHP > 5.4

Author

spiderman - spiderman1517650@163.com

License

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

Acknowledgements

PHP Reflection
JsonPath
Class Annotation