43

GitHub - yulonghu/asf: High performance PHP framework written in C, Work so easy...

 5 years ago
source link: https://github.com/yulonghu/asf
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

README.md

Asf - API Services Framework

Build Status

High performance PHP framework written in C, Work so easy.

Introduction

API Services Framework (or simply Asf). It's has many micro-innovation and is a new generation of lightweight MVC framework, internally called DLS.

Features

  • The class provided by the framework, loaded when the PHP process starts, and resident in memory.
  • When the PHP business logic is exception, the interface will only throw a '999' special error number.
  • Support for SQL CURD Log(Asf_Sql_Log), Run Exception information (Asf_Error_Log)
  • Support for Logger Buffer Cache, File descriptor auto-shutdown
  • More powerful GPC methods, making it easier to use PHP global variables ($_GET, $_POST, $_COOKIE)
  • Support for configuration file resident memory
  • Support for faster, easier-to-operate cookie management

Install

Requirements

  • PHP 7.0 +
  • GCC 4.4.0+ (Recommended GCC 4.8+)

DownLoad

git clone https://github.com/yulonghu/asf.git

Compile for Linux/Unix/Mac

Provide two installation methods. Select No.1, Use the following methods to install the extension:

cd asf/travis
sudo ./install -i /path/to/phpize -c /path/to/php-config

Select No.2, PHP extension standard installation:

cd asf/asf
/path/to/phpize
./configure --with-php-config=/path/to/php-config
make && make install

Add the extension to your php.ini

extension=asf.so

Restart the web server

Documentation

http://www.box3.cn/phpasf/index.html

Get Started

Use tools to create a new project

/php-bin-path/php asf-src/tools/asf_project.php /to-path/project_name

Layout

+ public
  | - index.php
+ config
  | - config.php
+ library
+ modules
    | - Bootstrap.php
    | - Constants.php
  + api
    |+ services
	   |- Index.php  // Default service
    |+ logics
    |+ daos

config/config.php

<?php
$configs = array(
    'asf' => array(
        'root_path' => APP_PATH . '/modules',
    )
);

return $configs;

public/index.php

<?php
define('APP_PATH', dirname(__DIR__));

$app = new Asf_Application(APP_PATH . '/config/config.php');
$app->run();

Default service

<?php
class IndexService
{
    public function indexAction()
    {
        return 'Hello World';
    }
}

Run in Nginx/Apache/Lighttpd

http://www.your-domain.com

Output results

{
    "errno": 0,
    "data": "Hello World"
}

License

Asf is open source software under the PHP License v3.01


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK