femtopixel/nano-framework 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

femtopixel/nano-framework

Composer 安装命令:

composer require femtopixel/nano-framework

包简介

Nano Framework - easier than easiest framework

README 文档

README

Caution

As-of 2021, this product does not have a free support team anymore. If you want this product to be maintained, please support my work.

Note

(This product is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added.)

logo

Nano Framework

Build Status Latest Stable Version Minimum PHP Version Scrutinizer Code Quality Code Coverage License PayPal donation Buy me a coffee Buy me a coffee

Nano is a simple stupid framework, really easy to handle, and really efficient.

It only implements the C part (Controller) of the MVC design pattern which allows developers to use any other existing library for others parts

Installation

composer require femtopixel/nano-framework

Bootstrap

all your request can be redirected to your bootstrap (assuming index.php)

<?php
require_once ('vendor/autoload.php');
$nano = new \Nano\Framework();
$nano->dispatch();

That's all!

How it works?

With that on, you can now access to your pages like this :

http://mysite.tld/ <controller>/<action>

And it will load the class \Project\Controller\<controller>::<method><action>Action

You can easily configure your namespace, controller package and action suffix!

<method> represents the HTTP method used (usually get but you can use post/update/delete etc...). This is optional.

Either <controller> or <action> are optional and considered as 'index' if not defined.

Therefore

url class::method
http://mysite.tld/ \Project\Controller\Index::indexAction
http://mysite.tld/test \Project\Controller\Test::indexAction
http://mysite.tld/test/action \Project\Controller\Test::actionAction
http://mysite.tld/also/work/with/full/path \Project\Controller\Also\Work\With\Full::pathAction
http://mysite.tld/my/normal \Project\Controller\My::getNormalAction
http://mysite.tld/my/normal (with HTTP post) \Project\Controller\My::postNormalAction

Parameter Matching

Since 0.6.0, you can use "Parameter Matching"

Simply activate it when dispatching :

require_once ('vendor/autoload.php');
$nano = new \Nano\Framework();
$nano->setParameterMatching()->dispatch();

And then you'll be able to use it like this :

<?php
namespace \Project\Controller;

class MyAwesomeController
{
    public function getHelloAction($age, $name)
    {
        echo "Hello $name, I'm {$age}yo"; //please, use this code for test only
    }
}

and call http://mysite.tld/myawesomecontroller/hello?name=World&age=900 to display "Hello World, I'm 900yo" !

统计信息

  • 总下载量: 64
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-06-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固