定制 thomasmrln/superway 二次开发

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

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

thomasmrln/superway

Composer 安装命令:

composer require thomasmrln/superway

包简介

New generation Php route : simply and fast !

README 文档

README

Superway is a PHP route allowing to forget your .htaccess and others way to route your urls.

Easy to "install" and launch. Superway was created to simplify the web developper work.

Usage

Intanciation

<?php
  // Instantiate your Superway router with your templates directory
  $sw = new Superway('./templates');
  
  // Superway has require to know the extension of file used
  $sw->extension  = 'php';  // Others with tpl, html, and more

Add road

Create your routes by adding roads.

Road is composed of : * the path of the file * the pattern of the URL

The power of Superway is the infinite integration of variables into the url, and the possibility of get this variables in your template, with her name.

<?php
  $sw->add_road(  new Road('/home',         '/'));
  $sw->add_road(  new Road('/blog/blog',    '/blog/'));
  $sw->add_road(  new Road('/blog/blog',    '/blog/search/{query}'));
  $sw->add_road(  new Road('/blog/blog',    '/blog/category/{id}'));
  $sw->add_road(  new Road('/blog/article', '/blog/article/{date}/{id}_{title}'));

Add an offroad

In case where Superway foundn't a route, it takes you back in the offroad Road, which is required.

<?php
  $sw->offroad(   new Road('/404',           '/404'));

Use variables

To use your variables passed in the pattern, you have just to call them with their name.

For example, the pattern '/blog/article', with this url : 'http://your_url.com/blog/article/2014-04/112_title-of-your-article/' leads the use of $date (== 2014-04), $id (== 112) and $title (==title-of-your-article)

Take the wheel and drive !

To drive your roads, you have juste to launch this code and wait result...

<?php
  try {
  	print $sw->drive();
  } catch (\Exception $e) {
  	print "Erreur : ".$e->getMessage();
  }

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-04-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固