Download the PHP package leizongmin/leiphp without Composer

On this page you can find all versions of the php package leizongmin/leiphp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package leiphp

version php license downloads

LeiPHP 轻量级的 PHP MVC 框架

Lightweight MVC framework for simplistic PHP apps.

LeiPHP is contained in one single PHP file. It works based on a config file and is perfect for small to medium PHP-powered projects.

Features:

此框架仅有一个文件,其中包含了MySQL数据库、上传文件、调试信息、导入依赖文件、模板和REST路由等一系列常用操作。API接口简单,学习成本低,开箱即用,适合用来快速写一些对性能要求不高的程序。

项目文件结构

安装

初始化

首先新建一个global.inc.php文件,所有程序通过加载该文件来进行配置及初始化:

如果通过composer安装,则载入路径应改为:

在所有php程序中,均可载入global.inc.php文件唉实现初始化LeiPHP:

REST路由

LeiPHP可以根据不同的请求方法来调用相应的处理函数完成请求,比如:

模板渲染

LeiPHP中提供了一个静态类 TPL 来渲染HTML模板:

模板文件存放在template目录内,比如要渲染template/index.html

模板文件中通过$locals变量来获取模板数据:

以下为模板渲染相关的方法:

操作MySQL数据库

LeiPHP中提供了一个静态类 SQL 来操作MySQL数据库(基于 mysqli 实现):

更简便的数据库操作:

条件格式:

上传文件操作

LeiPHP中提供了一个静态类 UPLOAD 来操作上传文件:

调试信息操作

LeiPHP中提供了一个静态类 DEBUG 来操作调试信息,当定义了常量APP_DEBUG时, 会在页面底部输出调试信息:

应用相关操作

LeiPHP中提供了一个静态类 APP 来进行应用相关的操作,及一些公共函数:

自动路由

LeiPHP中提供了一个静态类 ROUTER 来进行路由相关的操作:

示例

新建应用统一入口文件:index.php

新建首页处理程序:action/index.php

需要配置服务器的URL Rewrite,比如将 /app/(.*) 的所有请求转到/app/index.php?__path__=$1

使用PATH_INFO

通过/index.php/xxxx访问。

Apache的配置示例

Nginx的配置示例

SAE的配置示例

当请求 /app/my/action 时,会自动执行文件 /action/my/action.php

如请求 /app/my/action/ ,则自动执行文件 /action/my/action/index.php

License

基于MIT协议发布。


All versions of leiphp with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package leizongmin/leiphp contains the following files

Loading the files please wait ....