百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

pagon

> 编程语言
开源

现代 PHP 框架

200 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

现代 PHP 框架

Pagon

Pagon is Modern PHP framework with elegant syntax. It also allow you to build RESTful web applications quickly and easily.

Other languages: 中文文档

Quick Started

Installation

Pagon use Composer to manage its dependencies. First you need to have Composer installed globally.

You can also download a copy of the composer.phar in your repository's root, run a command such as the following:

bash
curl -s https://getcomposer.org/installer | php

via Download/Git

Download source files from Github or clone from Github

bash
$ git clone [email protected]:hfcorriez/pagon.git myapp
$ composer install # php composer.phar install

Via Composer Create-Project

bash
$ composer create-project pagon/pagon myapp # php composer.phar ...

Debugger server

You can use Pagon built-in debugger server for rapid development under development environment. please use a Nginx or Apache server for production environment.

bash
$ ./bin/pagon serve [-p|--port ]
Pagon serve at http://127.0.0.1:5000

Configuration

All of the configuration files for the Pagon are stored in the app/config directory.

Optional attributes

mode        # Runing mode
debug       # Debug mode
views       # Template directory
buffer      # Open a buffer or not
timezone    # timezone (default: UTC)
charset     # charset (default: UTF-8)
autoload    # Auto load directory
error       # Handle error or not
routes      # Routes
names       # Router name, auto created
alias       # Class aliases, for short class name
namespaces  # Namespaces
engines     # Template engines
errors      # Default errors
stacks      # stacks
mounts      # mounts
bundles     # bundles
locals      # locals
url_rewrite # Url rewrite or not

Routing

To get started, let's create our first route. In Pagon, the simplest route is a route to a Closure.

php
// Init app
$app = Pagon::create();

// Routing with a callback function
$app->get('/', function($req, $res) {
  $res->render('index.php');
});

// Routing with a class method
$app->get('/users/:id', 'Web\\User');

// Specify named parameters in your routes
$app->post('/users/:id(/:op)', 'Web\\UserOperator');

// Run app
$app->run();

Database

Pagon ships with a superb ORM: Paris. More detailed documentation and examples, please check out Paris Doc.

Simple Example

php
$users = \Model\User::dispense()->where('status', 1)->find_many();

Migration

Init Database schema

bash
./bin/cli db:init

Will execute file app/migrations/schema.sql

Migrate, Status

bash
$ ./bin/cli db:generate AddUserLoginTime
+f ./migrations/20141208030747_AddUserLoginTime.php

$ ./bin/cli db:status

 Status   Migration ID    Migration Name
-----------------------------------------
   down  20141208030747  AddUserLoginTime

$ ./bin/cli db:migrate
 == 20141208030747 AddUserLoginTime migrating
 == 20141208030747 AddUserLoginTime migrated 0.0084s

Except init command, all the other commands map to phpmig to execute。

Cli

Manage PHP shell for *unix console

./bin/cli

php
$app->command('db\:init', '\Command\DB\Init');
$app->command('queue\:start', '\Command\Queue\Start');

Execution

bash
$ ./bin/cli db:init
$ ./bin/cli queue:start

Showcase

iNews: https://github.com/Trimidea/inews

License

Copyright (c) 2014-2015 hfcorriez. MIT Licensed, see LICENSE for details.

Issues· 2 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPframeworkpagonphp

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言