GithubHelp home page GithubHelp logo

varimax's Introduction

Varimax

Varimax The Slim PHP Frameworks
  • Home: http://www.varimax.cn
  • Source: https://github.com/dcto/varimax
  • Issues: https://github.com/dcto/varimax/issues
  • License: MIT
  • IRC: #varimax on freenode

    License PHP version Latest Stable Version Total Downloads

    Develop environment

    touch the .env file into the root directory

    that's content sample like it's

    ENV=dev
    DEBUG=2
    

    ENV will load config directory config {ENV}.name

    about DEBUG option item 1 vs 2

    select 1 will be output error message without code error detail

    select 2 will be output detail code exception message to the client

    Router

    the varimax define some default route rule

    ':*'    =>  ':.+',
    ':str'  =>  ':[\w-]+',
    ':int'  =>  ':[1-9]\d+',
    ':num'  =>  ':[0-9.-]+',
    ':any'  =>  ':[\w!@$^&+-=|]+',
    ':hex'  =>  ':[a-f0-9]+',
    ':hash' =>  ':[a-z0-9]+',
    ':uuid' =>  ':[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
    

    Restful APIs Style

    Method     |  Path                |  Action   |
    ------------------------------------------------
    GET        |  /test               |  index    |
    GET        |  /test/(:id)         |  select   |
    POST       |  /test/create        |  create   |
    PUT/PATCH  |  /test/update/(:id)  |  update   |
    DELETE     |  /test/delete/(:id)  |  delete   |
    

    Router demo

    //公共组
    Router::group( ['id' => 'public', 'prefix' => '/', 'namespace' => 'App\Controller'], function () {    
        Router::any( '/test/(list:*)/(id:\d+)' )->call( 'Test@test' );
        Router::get( '/test/(shop:vip|user)' )->call( 'Test@shop' ); //only allow vip or user string
        Router::get( '/test/(shop:vip|user)/(id:|\d+)' )->call( 'Test@shop' );
        //注册
        Router::post( '/signup' )->call( 'User@register' );
        //登录
        Router::post( '/signin' )->call( 'User@login' );
        //登出
        Router::get( '/logout' )->call( 'User@logout' );
    
        //Restful CRUD
        Router::restful('/user')->call( 'User@restful');
    } );
    
    //验证组
    Router::group( ['id' => 'permit', 'prefix' => '/', 'namespace' => 'App\Controller', 'call' => 'App\Controller\Access@auth'], function () {
    
    } ); 
    

    About Deverloper

    Name : D.c (陶之11)

    Emai: [email protected]

  • varimax's People

    Contributors

    dcto avatar mydcto avatar

    Watchers

    Lucian avatar James Cloos avatar  avatar  avatar

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.