定制 victorium/yar 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

victorium/yar

Composer 安装命令:

composer require victorium/yar

包简介

Yet Another Router for PHP. Simple, Stupid and totally framework independent.

README 文档

README

Introduction

YAR is a very simple routing library for PHP that routes URLs to methods in classes.

Licence

All source files in YAR are released subject to the terms of the MIT license, as written in the included LICENSE.txt file.

Installation

Composer

YAR can be installed with composer (http://getcomposer.org/).

  1. Install composer:

    $ curl -s https://getcomposer.org/installer | php
    
  2. Require YAR as a dependency using composer:

    $ php composer.phar require victorium/yar
    

Getting Started

This is a simple example on getting started with YAR:

<?php

define("PATH_TO_YAR_SRC", dirname(__DIR__));

require PATH_TO_YAR_SRC . "/bootstrap.php";

use Yar\Http\Exception\Exception404;
use Yar\Http\Request;
use Yar\Router;

class Home {
    public function index() {
        echo "Hi from index";
    }

    public function sum($a, $b) {
        return $a + $b;
    }
}

$config = [
    "route" => [
        "max_parts" => 1000,
        "namespaces" => [""],
    ]
];

$request = Request::fromGlobals($config);

$override = ["" => "home/index"];
list($obj, $methodName, $args) = Router::createCallable($request, $override);
call_user_func([$obj, $methodName], $args);

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固