GithubHelp home page GithubHelp logo

sizzflair / php-gene Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sasou/gene-for-php5

0.0 2.0 0.0 58 KB

Simple, high performance,C extension framework for php!

License: Apache License 2.0

PHP 3.31% M4 1.88% JavaScript 0.22% C 94.59%

php-gene's Introduction

#php-gene

Simple, high performance,C extension framework for php!

版本 1.0.0

简单、高性能的php c扩展框架! 框架的核心是gene_application类,加载配置文件并启动:

<?php
$app = new gene_application('sdfsdf');
$app->load("router.ini.php")
    ->load("config.ini.php")
    ->run();

框架的基础是一个高性能的进程缓存模块,基于缓存模块,实现了一个高性能的强大路由解析以及配置缓存; 路由强大灵活,支持回调、rest、http请求方式(get,post,put,patch,delete,trace,connect,options,head)等:

<?php
$router = new gene_router();
$router->clear()
	->get("/",function(){
			echo "index";
		})
	->group("/admin")
		->get("/:name/",function($abc){
			echo $abc;
		})
		->get("/:name.:ext",function($abc){
			echo $abc;
		})
		->get("/:name/sasoud",function(){
			echo 'dd';
		},"name")
		->get("/blog/:ext/baidu",function(){
			echo 'baidu';
			return array('sdfasd'=>'baidu.edu.com');
		},"auth@clearAll")
		->get("/",function(){
			echo 'admin';
		},'adminauth')
	->group()
	->get("/index",function(){
		echo 'index';
	})
	->error(401,"gene_cache@get")
	->hook("auth",function(){
		echo " auth ";
	})
	->hook("before", function(){
		echo " before ";
	})
	->hook("after", function($params){
		echo " after ";
		if(is_array($params))var_dump($params);
	});

配置类支持bool、int、long、string、array、常量等数据类型:

<?php
$config = new gene_config();
$config->clear();
$config>set("dsfsdfsd",array('_url'=>array('sd'=>'sdfsdf222','sds'=>'sdfsf678'),'port'=>3307));
支持快捷调用(.分隔):
$config->get("dsfsdfsd.port");

安装:

phpize
./configure --with-config-file-path=PATH --disable-all --enable-cli --enable-cgi --enable-gene=shared
make
make install

DEMO:

index.php 启动文件
config.ini.php 配置文件
router.inc.php 路由文件

测试:

测试网站:php-gene.com
http://php-gene.com/
可测试路由实例:
http://php-gene.com/admin
http://php-gene.com/index
http://php-gene.com/admin.html
http://php-gene.com/admin/demo.jpg
http://php-gene.com/admin/ajax.js
http://php-gene.com/admin/blog/test/baidu

php-gene's People

Contributors

sasou avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.