Download the PHP package autorealm/faddle without Composer

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

Faddle - a liberalization PHP Framework

Faddle Framework is just a PHP MVC system to give developers the creative experience of developing a web application. It's designed to be lightweight and modular, allowing developers to build better and easy to maintain&migrate code with PHP.

Installation

It's recommended that you use Composer to install Faddle.

This will install Faddle and the only dependency:PHP-PSR. Faddle requires PHP 5.5.0 or newer.

Usage

Create an index.php file with the following contents:

You may quickly test this using the built-in PHP server:

Going to http://localhost:8000/hello/world will now display "Hello, world".


如何配置

最开始着手的 PHP 程序都应当配置好的,以下是推荐的配置。

可以单独写在一个独立配置文件中,只在使用 Faddle\View::make($tpl, $data, $config) 时引入即可。


开始使用

APP

APP 是最先应该建立的对象,该对象仅作为容器,可以依赖并注入其他任何对象或者方法。

APP 的相关代码应该写在单独的文件,如:app.php

可选参数:1.应用目录位置,2.配置文件路径

该方法推荐引入其他业务代码文件,因为是在闭包状态下运行的,里面定义的变量不会影响到全局环境。

以下是示例。

error, notfound, badrequest, unavailable, next, end

事件仅在 $app->run() 后产生。其中正常会触发的事件有start(开始) before(进入路由) obtain(已匹配) end(结束)

以下示例表示把要输出的内容转换为 JSON 格式

Route 路由

主路由器

默认主路由是 APP 注入的 router 对象。

路由的路径参数说明:

  1. /path1/path2:全匹配模式,只有 Uri 的 Path 完全一样才匹配。

  2. /post/{id:int}:通用匹配模式,其中id为返回给回调的参数名称,int表示类型,只有是数字时才匹配。

  3. /post/(?list|list.json):正则匹配模式,具体可参考正则表达式规则。

路由的回调处理函数(或者称为 Controller 控制器的 Action 动作),返回值说明:

  1. 返回内容(非 null, boolean),表示在回应中输出该内容。

  2. 返回 null 或没有返回任何内容,则表示不在回应中做输出处理。

  3. 返回 true,表示回应已做处理,可以输出。

  4. 返回 false,则表示触发服务不可用错误。

单路由

可以通过 faddle_route()快速建立一个单路由,再通过 $router->set($route) 配置到路由器中。 以下是建立单路由的参数说明:

  1. 请求方法,get 或者 post 也可以用数组包含多个。

  2. 路径,见上方说明。

  3. 回调函数,可以是任何 callable 类型。或者使用 Controller@Action 这种方式。

  4. [可选]名称,表示这个路由的名称,以后可以进行识别。

  5. [可选]命名空间,当使用的控制器包含命名空间时,可以在这里定义。

路由器 Router 的 get post put 等方法返回的也是单路由 Route 对象。

子路由

任何路由器对象都可以通过 group 方法包含子路由器对象(称为蓝图)。

服务路由

可以快速配置多域名路由或多个蓝图。

Middleware 中间件

中间件即为传递请求时需经过的业务处理方法。可在全局路由,单路由,或者匹配路径中进行设置。

View 视图

视图可通过 extend方法进行扩展。

ViewEngine 视图引擎

Faddle 有自带的视图模板引擎。


进阶使用

详见文档。


Documentation

License

The project is developed by KYO and distributed under the MIT LICENSE

Thanks

All Github Open-source Contributor!


All versions of faddle with dependencies

PHP Build Version
Package Version
Requires php Version ^5.5.16 || ^7.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 autorealm/faddle contains the following files

Loading the files please wait ....