Giter Club home page Giter Club logo

scf-flight's Introduction

scf-flight

Make FlightPHP Framework running on Tencent SCF environment
在腾讯云云函数上运行FlightPHP框架,低成本迁移

scf能运行的,web一定能。web能运行的,可能需要一定修改,详见下面。

可用

$_POST
$_GET
$_FILES //不能太大
$_SERVER
$_COOKIE
Flight::request()->data
Flight::request()->body
Flight::response()->header("X-By","scFlight");
Flight::response()->status(404);
Flight::setcookie($key,$value,$options);    //php 7.3 setcookie方式
//Flight框架中的一切函数
//等等

不可用

header();           
setcookie();        //使用Flight::setcookie();代替
session_start();    //不支持,因为scf不保存session

安装

须同时安装mikecao/flightxytoki/scf-flight。本项目暂未发布至composer,需从github安装。

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/xytoki/scf-flight"
        }
    ],
    "require": {
        "xytoki/scf-flight": "dev-master",
		    "mikecao/flight": "^1.3"
    }
}

之后将Flight::start();替换为以下内容即可。本项目会自动检测腾讯云scf环境并使框架正常运行。

if(isset($_ENV['TENCENTCLOUD_RUNENV'])){
    function main_handler($event, $context){
        return Flight::start($event, $context, dirname(__FILE__));
    }
}else{
    Flight::start();
}

scf-flight's People

Contributors

xytoki avatar

Stargazers

 avatar  avatar mike avatar Margie J Drennon avatar  avatar  avatar iKing avatar  avatar Jax avatar arch avatar

Watchers

James Cloos avatar  avatar

scf-flight's Issues

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.