# simple-router
Simple, fast and yet powerful PHP router that is easy to get integrated and in any project. Heavily inspired by the way Laravel handles routing, with both simplicity and expand-ability in mind.
With simple-router you can create a new project fast, without depending on a framework.
**It only takes a few lines of code to get started:**
```php
SimpleRouter::get('/', function() {
return 'Hello world';
});
```
### Support the project
If you like simple-router and wish to see the continued development and maintenance of the project, please consider showing your support by buying me a coffee. Supporters will be listed under the credits section of this documentation.
You can donate any amount of your choice by [clicking here](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NNX4D2RUSALCN).
## Table of Contents
- [Getting started](#getting-started)
- [Notes](#notes-1)
- [Requirements](#requirements)
- [Features](#features)
- [Installation](#installation)
- [Setting up Apache](#setting-up-apache)
- [Setting up Nginx](#setting-up-nginx)
- [Setting up IIS](#setting-up-iis)
- [Configuration](#configuration)
- [Helper functions](#helper-functions)
- [Routes](#routes)
- [Basic routing](#basic-routing)
- [Class hinting](#class-hinting)
- [Available methods](#available-methods)
- [Multiple HTTP-verbs](#multiple-http-verbs)
- [Route parameters](#route-parameters)
- [Required parameters](#required-parameters)
- [Optional parameters](#optional-parameters)
- [Regular expression constraints](#regular-expression-constraints)
- [Regular expression route-match](#regular-expression-route-match)
- [Custom regex for matching parameters](#custom-regex-for-matching-parameters)
- [Named routes](#named-routes)
- [Generating URLs To Named Routes](#generating-urls-to-named-routes)
- [Router groups](#router-groups)
- [Middleware](#middleware)
- [Namespaces](#namespaces)
- [Subdomain-routing](#subdomain-routing)
- [Route prefixes](#route-prefixes)
- [Partial groups](#partial-groups)
- [Form Method Spoofing](#form-method-spoofing)
- [Accessing The Current Route](#accessing-the-current-route)
- [Other examples](#other-examples)
- [CSRF-protection](#csrf-protection)
- [Adding CSRF-verifier](#adding-csrf-verifier)
- [Getting CSRF-token](#getting-csrf-token)
- [Custom CSRF-verifier](#custom-csrf-verifier)
- [Custom Token-provider](#custom-token-provider)
- [Middlewares](#middlewares)
- [Example](#example-1)
- [ExceptionHandlers](#exceptionhandlers)
- [Handling 404, 403 and other errors](#handling-404-403-and-other-errors)
- [Using custom exception handlers](#using-custom-exception-handlers)
- [Prevent merge of parent exception-handlers](#prevent-merge-of-parent-exception-handlers)
- [Urls](#urls)
- [Get the current url](#get-the-current-url)
- [Get by name (single route)](#get-by-name-single-route)
- [Get by name (controller route)](#get-by-name-controller-route)
- [Get by class](#get-by-class)
- [Using custom names for methods on a controller/resource route](#using-custom-names-for-methods-on-a-controllerresource-route)
- [Getting REST/resource controller urls](#getting-restresource-controller-urls)
- [Manipulating url](#manipulating-url)
- [Useful url tricks](#useful-url-tricks)
- [Input & parameters](#input--parameters)
- [Using the Input class to manage parameters](#using-the-input-class-to-manage-parameters)
- [Get single parameter value](#get-single-parameter-value)
- [Get parameter object](#get-parameter-object)
- [Managing files](#managing-files)
- [Get all parameters](#get-all-parameters)
- [Check if parameters exists](#check-if-parameters-exists)
- [Events](#events)
- [Available events](#available-events)
- [Registering new event](#registering-new-event)
- [Custom EventHandlers](#custom-eventhandlers)
- [Advanced](#advanced)
- [Disable multiple route rendering](#disable-multiple-route-rendering)
- [Restrict access to IP](#restrict-access-to-ip)
- [Setting custom base path](#setting-custom-base-path)
- [Url rewriting](#url-rewriting)
- [Changing current route](#changing-current-route)
- [Bootmanager: loading routes dynamically](#bootmanager-loading-routes-dynamically)
- [Adding routes manually](#adding-routes-manually)
- [Custom class-loader](#custom-class-loader)
- [Integrating with php-di](#Integrating-with-php-di)
- [Parameters](#parameters)
- [Extending](#extending)
- [Help and support](#help-and-support)
- [Common issues and fixes](#common-issues-and-fixes)
- [Multiple routes matches? Which one has the priority?](#multiple-routes-matches-which-one-has-the-priority)
- [Parameters won't match or route not working with special characters](#parameters-wont-match-or-route-not-working-with-special-characters)
- [Using the router on sub-paths](#using-the-router-on-sub-paths)
- [Debugging](#debugging)
- [Creating unit-tests](#creating-unit-tests)
- [Debug information](#debug-information)
- [Benchmark and log-info](#benchmark-and-log-info)
- [Reporting a new issue](#reporting-a-new-issue)
- [Procedure for reporting a new issue](#procedure-for-reporting-a-new-issue)
- [Issue template](#issue-template)
- [Feedback and development](#feedback-and-development)
- [Contribution development guidelines](#contribution-development-guidelines)
- [Credits](#credits)
- [Sites](#sites)
- [License](#license)
___
# Getting started
Add the latest version of the simple-router project running this command.
```
composer require pecee/simple-router
```
## Notes
The goal of this project is to create a router that is more or less 100% compatible with the Laravel documentation, while remaining as simple as possible, and as easy to integrate and change without compromising either speed or complexity. Being lightweight is the #1 priority.
We've included a simple demo project for the router which can be found [here](https://github.com/skipperbent/simple-router-demo). This project should give you a basic understanding of how to setup and use simple-php-router project.
Please note that the demo-project only covers how to integrate the `simple-php-router` in a project without an existing framework. If you are using a framework in your project, the implementation might vary.
You can find the demo-project here: [https://github.com/skipperbent/simple-router-demo](https://github.com/skipperbent/simple-router-demo)
**What we won't cover:**
- How to setup a solution that fits your need. This is a basic demo to help you get started.
- Understanding of MVC; including Controllers, Middlewares or ExceptionHandlers.
- How to integrate into third party frameworks.
**What we cover:**
- How to get up and running fast - from scratch.
- How to get ExceptionHandlers, Middlewares and Controllers working.
- How to setup your webservers.
## Requirements
- PHP 7.1 or greater (version 3.x and below supports PHP 5.5+)
- PHP JSON extension enabled.
## Features
- Basic routing (`GET`, `POST`, `PUT`, `PATCH`, `UPDATE`, `DELETE`) with support for custom multiple verbs.
- Regular Expression Constraints for parameters.
- Named routes.
- Generating url to routes.
- Route groups.
- Middleware (classes that intercepts before the route is rendered).
- Namespaces.
- Route prefixes.
- CSRF protection.
- Optional parameters
- Sub-domain routing
- Custom boot managers to rewrite urls to "nicer" ones.
- Input manager; easily manage `GET`, `POST` and `FILE` values.
- IP based restrictions.
- Easily extendable.
## Installation
1. Navigate to your project folder in terminal and run the following command:
```php
composer require pecee/simple-router
```
### Setting up Nginx
If you are using Nginx please make sure that url-rewriting is enabled.
You can easily enable url-rewriting by adding the following configuration for the Nginx configuration-file for the demo-pro
没有合适的资源?快使用搜索试试~ 我知道了~
非常牛逼的PHP代码加密系统MENC – JIAMI系统 V1.0.2

共1348个文件
php:756个
js:194个
gif:88个

需积分: 0 28 下载量 182 浏览量
2023-03-23
15:30:56
上传
评论
收藏 7.01MB ZIP 举报
温馨提示
PHP代码加密系统 S G 拓展加密 自定义php版本[支持] LIC双重加密 [支持] 自定义头部版权[支持] 限制I P 访问 [支持] 限制域名访问 [支持] 限制MAC地址 [支持] 限制机器ID [支持] 设置到期时间 [支持] DECK 混杂加密 混杂逻辑功用 [多重] [双层] 加密驱动功用 [稳定] [加强] 反复加密次数 [1] [2] [2] 错误解析功用 [开启] [关闭] 自定义头部版权 [支持] GOTO 混杂加密 限制域名访问 [支持] 限制访问内容 [支持] 自定义头部版权 [支持] 装置前请认真阅读程序运用阐明
资源推荐
资源详情
资源评论





























收起资源包目录





































































































共 1348 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
资源评论


普通网友
- 粉丝: 4731
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 全国计算机等级测验二级C语言公共基础知识点汇总.doc
- 嵌入式系统课程设计方案要求.doc
- 大数据视角下高校思政教育的转向与发展路径探讨.docx
- 新时期农机推广中互联网技术的应用分析.docx
- 计算机视觉领域中常用的各类工具汇总与介绍
- 施工项目管理成本管理分析.doc
- 大数据时代高校网络思政教育体系的构建.docx
- 整合式信息化办公室设计.doc
- 区块链共识算法的比较研究.docx
- 86智能家居系统功能研究.doc
- 浅析大数据时代金融行业受到的冲击和变革.docx
- 精细化、科学化--大数据背景下电力企业营销管理创新机制.docx
- access的学生完整管理.doc
- 互联网金融个体网络借贷资金存管业务规范.docx
- 网络安全的现状及应对措施探微.docx
- 南京航空航天大学计算机视觉大作业第二部分设计与实现 南京航空航天大学计算机视觉大作业第二部分任务方案 NUAA 计算机视觉课程大作业第二部分内容要求 南京航空航天大学(NUAA)计算机视觉大作业第二部
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
