Download the PHP package pfinal/leaf without Composer

On this page you can find all versions of the php package pfinal/leaf. 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 leaf

Leafphp 快速入门

安装

交流QQ群

17778706

编码规范

基本概念约定

目录结构

开启调式模式

nginx配置

路由

下面以demo项目为例

config/routes.php 中定义路由

基本 GET 路由,浏览器访问 http://localhost/demo/web

只允许POST请求的路由,以POST方法访问 http://localhost/demo/web/foo

注册路由响应任意方式的HTTP请求,不对请求方法进行限制,post或get均可,浏览器访问 http://localhost/demo/web/bar

基础路由参数 浏览器访问 http://localhost/demo/web/user/1

方法注入,框架将自动注入Leaf\Request实例,浏览器访问 http://localhost/demo/web/foo?name=leaf

支持注入的对象

生成URL

如果访问时url中没有隐藏入口文件index.php,则生成的url也会自动包含index.php

请求与响应

Request

Response

重定向

中间件

编写中间件类 src/Middleware/TestMiddleware.php

注册一个名为test的中间件

为路由绑定这个test中间件

浏览器访问

`http://localhost/demo/web/info?age=17`   被中间件拦截
`http://localhost/demo/web/info?age=18`   请求将被通过

为一组路由绑定中间件 (绑定多个中间件,传入数组即可)

如果希望中间件,在执行之后生效,可以使用下面的方式, $next()返回值可能是Request\Response对象或string

控制器

控制器类通常以Controller作为后缀,例如 src/Controller/SiteController.php

任何PHP类均可作为控制器

路由指向控制器中的方法

浏览器访问 http://localhost/demo/web/home

如果需要包含多个字词,建议在 URI 中使用中杠来分隔,例如user-profile

使用注解语法注册路由,自动注册路由。class上的Middleware,将对整个控制器生效

添加注解路由 Route::annotation('Controller\UserController');

视图

支持twig和blade模板引擎,跟据后缀自动识别。

twig http://twig.sensiolabs.org

blade http://laravel.com/docs/5.1/blade

将变量共享给所有模板

扩展twig模板 增加一个count函数,用于在模板中统计数组成员数量(twig提供了length过滤器)

twig中使用自定义的count函数

Bundle

Bundle可以更好的组织功能模块

目录结构

Bundle类,继承自Leaf\Bundle类即可,主要用于定位Bundle所在目录

注册Bundle

加载视图

Bundle的视图文件位于Bundle的resources/views目录中

顶级views目录中,与Bundle同名目录下的视图文件,将优先使用。 例如/views/FooBundle/home.twig,将替换src/FooBundle/resources/views/home.twig文件。

加载路由

Bundle注册后,Bundle的路由文件会自动加载,例如FooBundle/resources/routes.php

自动生成Bundle

数据库

基本用法

查询构造器

手动分页

数据库操作详细文档

系统服务

会话,调用Session相关方法时,会自动开启Session

表单验证

验证器详细文档

错误

日志

验证码

文件上传

认证

权限

自定义分页样式

命令行

更多扩展


All versions of leaf with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
symfony/http-foundation Version ^2.0
symfony/console Version ^2.0
pfinal/blade Version ^1.0
pfinal/database Version ^1.0
pfinal/session Version ^1.0
pfinal/routing Version ^1.8
twig/extensions Version ^1.0
psr/log Version ^1.0
monolog/monolog Version ^1.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 pfinal/leaf contains the following files

Loading the files please wait ....