Code Monkey home page Code Monkey logo

core's Introduction

Version Monthly Downloads PHPStan: Level 6 License PHP Version Require Matrix

What is Flight?

Flight is a fast, simple, extensible framework for PHP. Flight enables you to quickly and easily build RESTful web applications.

Basic Usage

// if installed with composer
require 'vendor/autoload.php';
// or if installed manually by zip file
// require 'flight/Flight.php';

Flight::route('/', function () {
  echo 'hello world!';
});

Flight::start();

Skeleton App

You can also install a skeleton app. Go to flightphp/skeleton for instructions on how to get started!

Documentation

We have our own documentation website that is built with Flight (naturally). Learn more about the framework at docs.flightphp.com.

Community

Chat with us on Matrix IRC #flight-php-framework:matrix.org

Upgrading From v2

If you have a current project on v2, you should be able to upgrade to v2 with no issues depending on how your project was built. If there are any issues with upgrade, they are documented in the migrating to v3 documentation page. It is the intention of Flight to maintain longterm stability of the project and to not add rewrites with major version changes.

Requirements

Important

Flight requires PHP 7.4 or greater.

Note: PHP 7.4 is supported because at the current time of writing (2024) PHP 7.4 is the default version for some LTS Linux distributions. Forcing a move to PHP >8 would cause a lot of heartburn for those users.

The framework also supports PHP >8.

Roadmap

To see the current and future roadmap for the Flight Framework, visit the project roadmap

License

Flight is released under the MIT license.

core's People

Contributors

alexshadie avatar bellenottelling avatar berkus avatar davidkuridza avatar dstelljes avatar enyst avatar everflux avatar fadrian06 avatar hitautodestruct avatar hlidotbe avatar juneszh avatar kafene avatar kouts avatar krmu avatar larsjk avatar masroore avatar merkuriy avatar mikecao avatar n0nag0n avatar orthographic-pedant avatar ozh avatar pborreli avatar pine3ree avatar pluveto avatar saschanos avatar sethbattin avatar smeinecke avatar spytheman avatar susuper avatar tamtamchik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

core's Issues

Routing and objects

Hello,
I would like to propose a question:

At this time, this is what I'm doing to avoid the use of static methods:

$errorController=new ErrorController();
Flight::route('/error/pagenotfound',array($errorController,'pagenotfound'));
Flight::route('/error/browser',array($errorController,'browser'));

$homeController=new HomeController();
Flight::route('/',array($homeController,'index'));

However, when there are no errors, the $errorController object is created anyway.Thus I'm uselessly occuping memory.

Is there a smarter way of doing it? Some kind of lazy loading ?

Regards
Thank you!

404 Error out the box

I just downloaded flight and then accessed it via localhost http://localhost:8888/E/Elliot%20Greenwood/Web/prototype/ & I received a 404 Not Found Error (from Flight not the Server).

I've added the following .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]

my httpd.conf has got AllowOverride All in it.

Flight::request()->base returns /E/Elliot Greenwood/Web/prototype & Flight::request()->url returns /E/Elliot%20Greenwood/Web/prototype/

All of the code as it was when I downloaded it, should I have changed something? The readme file says to create the index.php file but the download included it with the code already in there. I'm not sure what is going on.

Thanks,
Elliot

Class Autoloader Throws Exceptions

The Class Autoloader in Flight throws an exception if it can't find anything. If you have multiple autoloaders this will break things, as none of the possible autoloaders to follow will be executed.

This for example makes using Twig with Flight impossible.

Multilanguage routing

Hi,

Could you help to understand how to create a multilingual site with Flight?

For example, I want my site to have such languages: en (default), de, fr, it, ....
Language identifier is presented in URL: http://example.com/de/hello/
But the default language ('en' for this example) has not to be presented in URL.
An URL http://example.com/hello/ means English page.

How it is better to achieve this?

Thanks

Flight::request()->ip when behind an http proxy

I changed the Request class to get the ip address when behind a proxy:
I added a private function getRealIpAddr() and called it to retreive the ip property

private function getRealIpAddr()
{
    if (!empty($_SERVER['HTTP_CLIENT_IP']))
    {
        $ip=$_SERVER['HTTP_CLIENT_IP'];
    }
    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
    {
        $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
        $ip=$_SERVER['REMOTE_ADDR'];
    }
    return $ip;
}

lastModified and etag return worng headers

_lastModified() and _etag() use the _halt method for returning a 304 response, but the _halt method clear the cache by calling ->cache(false) on the response.
In this way the 304 response remain for 1 request and on the next a 200 response is sent instead of the 304.
You should modify with something like this:

    public function _lastModified($time) {
        $this->response()->header('Last-Modified', date(DATE_RFC1123, $time));

        if ($time === strtotime(getenv('HTTP_IF_MODIFIED_SINCE'))) {
            header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $time) . ' GMT', true, 304);
        }
    }

Flight::json + Flight::lastModified conflict

If you use Flight::json and Flight::lastModified at the same time, the Last-Modified header is never sent, which means the If-Modified-Since header can never be correctly handled.

It seems to be down to Flight::json behind the scenes using a new instance of the flight\Response class in flight/Flight.php around line 400.

This can easily be quite easily reproduced with the following routes:

Flight::route('flight_json', function () {
    // Broken example using Flight::lastModified + Flight::json
    $modified = strtotime("2012-11-12 00:00:00");
    Flight::lastModified($modified);

    $json = array(
        'uts_modified' => $modified,
        'type' => 'Flight::json'
    );
    Flight::json($json);
});

Flight::route('json_encode', function () {
    // Working example using Flight::lastModified and manually echoing json_encode
    $modified = strtotime("2012-11-12 00:00:00");
    Flight::lastModified($modified);

    $json = array(
        'uts_modified' => $modified,
        'type' => 'Flight::json'
    );

    // Same as Flight::json method but doesn't use a new instance of the response object
    Flight::response()
        ->status(200)
        ->header('Content-Type', 'application/json')
        ->write(json_encode($json))
        ->send();
});

Is this the expected behaviour with a reason why a new instance of flight\Response is used or simply an oversight?

Polluting the Namespace

I'm interested in polluting the namespace. I know where supposed to be good and properly namespace stuff. But for simple flight apps it just clutters stuff up. I come from the sinatra world where you have beautiful stuff like:

get '/path' do
  json my_data
end

So the following just seems crazy:

Flight::route('/path', function() {
  Flight::json(my_data());
});

Now most of this hot mess comes from PHP being so verbose. But I'm wondering if the Flight clutter could be removed. I'm thinking something like:

Flight::pollute();

route('/path', function() {
  json(my_data());
});

So the app would specifically request Flight to pollute. That would create bring route, json, etc into the global scope. Obviously this doesn't scale for big apps. But many Flight apps aren't meant to be big. Removing all the Flight:: prefixes makes the code more readable. Obviously someone who pollutes takes the risk of not working in namespaces.

My current workaround is to alias Flight as _. So:

use Flight as _;

_::route('/ping', function() {
  _::json(array('version' => '1'));
});

It's not bad but not having the _:: would be even better. Should I submit a pull request or would you rather not encourage this sort of behavior. :)

Full namespacing and explicit init()

Nice work on this framework. In particular I like that it does not alter global state by auto-starting a session or ini_set()-ing values, because this allows embedding into existing apps with their own session. Just a couple things bug me:

  1. IMO all class names should be namespaced, particularly names as common as "Request", "View", etc. You could prepend "Flight_" to these names or placing them under a real "Flight" namespace. This would also help bring the framework in line with the PSR0 autoloading standard.
  2. I think it's poor form for class files (like Flight.php) to automatically execute code (init()). Having the user call the init would not be unreasonable. In general I'd have autoloading setup so calling Flight::init() would load the class file anyway.

Anyway, just some opinions. Have a good one.

Go to next route

Is there a way to go to the next route, like this:

Flight::route('GET /admin/*', function(){
//Apply authentication
Flight::next();
});

Flight::route('GET /admin/posts', function(){
//Business logic
});

Thanks.

No error on class not found

Take from the doc:

class Greeting {
    public static function hello() {
        echo 'hello world!';
    }
}

Flight::route('/', array('Greetings','hello')); #notice the 's' at the end

Flight will output nothing, should have throw error/exception class not found..

Redirect does not append base path for non-absolute URLs

Hi Mike,

Redirect does not append base path for non-absolute URLs, so when you use Flight::redirect('somewhere'); and your installation is not in root, it won't redirect properly.

This is the fix - Flight.php, line 367:
(I don't know how to send differently, new to Github)

public static function _redirect($url, $code = 303) {
    // If this is not an absolute URL, add the base path
    if (!strpos($url, '//') || strpos($url, 'http://')) {
        $url = self::request()->base.'/'.$url;
    }
   (...)

Btw, thanks for such a cool framework :)

Cheers

Request use file_get_contents

Hi,

I see that Request class use file_get_contents function.

This is disable on my server for security reason.

On line 53 there is:

'body' => file_get_contents('php://input')

Can you replace this with cURL example:

function file_get_contents_curl($url) {
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);       

    $data = curl_exec($ch);
    curl_close($ch);

    return $data;
}

Handling PUT or DELETE request

I didn't see any PUT or DELETE request handling in the docs. Is it yet supported? Thats the only thing is blocking me from using the framework for my backbone.js project.

How do you call something on start and end of framework?

Hello,

I am trying to figure out how Flight::after and Flight::before work. I am calling something that outputs a timestamp in microseconds and I am trying to do it on start of the framework and after the "results" of the framework have been outputted.

However it seems to be getting called instantly, rather then on start/end of framework.

Flight::after('start', Profiler_Console::logSpeed('Start Application'));
Flight::after('render', Profiler_Console::logSpeed('End Application'));

output

0.04
0.17

I believe the start is correct but how can I call "stop" after everything is done (regardless of what kind of data was outputted)?

500 Internal Server Error for routes

Hi,

after upgrade to phpfox 5.5.3 I got 500 error for this simple route:

Flight::route('/member(/@page)', array('Member','browse'), $page);

The error is caused by $page which is not defined

500 Internal Server Error
Undefined variable: page (8)
#0 C:\WebServer2\htdocs\test\app\routes.php(21): Flight::handleError(8, 'Undefined varia...', 'C:\WebServer2\h...', 21, Array)
#1 C:\WebServer2\htdocs\test\app\bootstrap.php(38): require_once('C:\WebServer2\h...')
#2 C:\WebServer2\htdocs\test\index.php(15): require_once('C:\WebServer2\h...')
#3 {main}

Passing variables to the layout

Hi man!

First of all nice work on this framework I love it's simplicity and small footprint.

Right now I'm working on an small utility and I'm using layouts, I notice that there is not an easy way to pass data to that layout (for example the title of the page) cause when your are fetching the layout on the _render method of the Flight class the data is hardcoded using array($key => $content) as data parameter.

By the way I found that at the end the View class does a merge when rendering with the data you have passed and the data assigned directly to the view using Flight::view()->set('var', $value);.

If this is the expected way to pass data to the layout I think will be great to add a small paragraph on the view section of the webpage (on the learn section) just to let the users know how to do it and avoid them spending time searching how to deal with that.
If this is not the expected behavior I think the patch is really easy (added below just in case).

On line 538 of Flight.php replace:

self::view()->render($layout, array($key => $content));

with:

self::view()->render($layout, array_merge((array)$data, array($key => $content)));

Thank you!

Define path to custom class

Hi,

I just start play with flight, very nice!

I have a questions regarding routing to a specific class/method.

The code example that call Greetings class:

require 'flight/Flight.php';
Flight::route('/', array('Greetings','hello'));
Flight::start();

work fine only if Greetings.php class is on the root.
How to move this into a subfolder and setup the path?

The same when register a new class.
How to put this into a folder example Library, and then register this class?

Thanks

Flight autloader clashing with RedBeanPHP

Hi there,

i am using Flight together with RedBeanPHP https://github.com/gabordemooij/redbean as ORM and after the latest changes on the Flight Loader class i noticed the problem that an exception is thrown when a class can not be found.

RedBean has something called FUSE. This mechanism will try to find a class that corresponds to a RedBean bean (which is something like a DataObject). So if you have a bean, e.g. called "person" and you call a method on person, RB will try to look for a class named Model_Person (using whatever autoloader there is) and pass the method call to that class, if found. If there is no class with that name, RedBean wants to continue with program flow, but with the latest Flight Loader changes an exception is thrown, halting the program flow.

I suggest the Loader class shall not throw an exception.

Please also review the issue posted at RedBean gabordemooij/redbean#294 for more information.

Need "splat" or similar for wildcard match

If I have a route like 'GET /api/content/*', and someone submits a URL like '/api/content/home/about', I want to be able to get the 'home/about' part in an function argument. It might work like this:

Flight::route('GET /api/content/*', function($wildcard) {
echo $wildcard;
});

The Ruby REST library Sinatra allows this:

get '/say//to/' do

matches /say/hello/to/world

params[:splat] # => ["hello", "world"]
end

get '/download/.' do

matches /download/path/to/file.xml

params[:splat] # => ["path/to/file", "xml"]
end

Regex error in Router.php

Hi! First of all thank you for that valuable microframework ;)
I think there´s a bug; URL's are not unique; when calling Flight::route('/love', function(){});, it matches /love, and /love/
Thanks! ;)

Undefined index

I just restored default error handler and got multiple notices.

Notice: ob_end_clean() [ref.outcontrol]: failed to delete buffer. No buffer to delete in D:\www\flight\net\Response.php on line 154
Notice: Undefined index: router in D:\www\flight\core\Dispatcher.php on line 74
Notice: Undefined offset: 1 in D:\www\flight\net\Router.php on line 61
Notice: Undefined index: router in D:\www\flight\core\Dispatcher.php on line 74
Notice: Undefined index: request in D:\www\flight\core\Dispatcher.php on line 74
Notice: Undefined index: HTTP_X_REQUESTED_WITH in D:\www\flight\net\Request.php on line 50
Notice: Undefined index: CONTENT_TYPE in D:\www\flight\net\Request.php on line 54
Notice: Undefined index: CONTENT_LENGTH in D:\www\flight\net\Request.php on line 55
Notice: Undefined index: GET in D:\www\flight\net\Router.php on line 123
Strict Standards: Only variables should be passed by reference in D:\www\flight\Flight.php on line 279
hello world!
Notice: Undefined index: response in D:\www\flight\core\Dispatcher.php on line 74

Here is my code:

require 'flight/Flight.php';
restore_exception_handler();
restore_error_handler();
error_reporting (-1);
Flight::route('/', function(){
  echo 'hello world!';
});
Flight::start();

got header

how could be possibile to get all http request headers (custom headers too)?

Regular Expressions Match

I need match validated IP address.
so i find this regexp: \b((2[0-5]{2}|1[0-9]{2}|[0-9]{1,2}).){3}(2[0-5]{2}|1[0-9]{2}|[0-9]{1,2})\b
how to route it?

follow can't work!
Flight::route('/search/@ip:(\b((2[0-5]{2}|1[0-9]{2}|[0-9]{1,2}).){3}(2[0-5]{2}|1[0-9]{2}|[0-9]{1,2})\b)', function($ip)

[Question] Changing the Flight "base" path.

Hello,

I was wondering whether there is a proper / more sensible way to go about altering a Flight Requests base path (without hacking the core).

The issue has come about in a system I'm working on where we are referencing the flight index.php from an .htaccess file in a different folder. As a result flight is getting passed paths with a "base" different from the dirname($_SERVER['SCRIPT_NAME']) it expects, which ends up throwing all the routing off.

To get around the problem I've end up essentially doing this (prior to the Flight::start(); ) which seems to work, although doesn't feel like a particularly clean solution.

      Flight::request()->base = '/app/public';
      Flight::request()->url = substr(Flight::request()->url, strlen(Flight::request()->base));

Just wondering if there is a "correct" way to set these options that I'm for some reason not seeing.

Thanks,
Carl

Redirect with base?

I've been scratching my head about why Flight has the following code in it's source:

https://github.com/mikecao/flight/blob/master/flight/Flight.php#L367

The problem I'm having with it, as it is written, is that my site is based on a subdomain/rewrite system. So, if you go to http://test.example.com/index.php, this hits a rewrite rule that shows the contents of public_html/test/index.php, where "public_html" is my document root.

In this state the value of Flight's "base" is set to dirname(getenv('SCRIPT_NAME')), which is "/test" on my server. Note however that, due to the rewrite, the url in the browser does not contain the "/test" fragment, instead it just reads: "http://test.example.com/index.php".

Now the part I don't understand: if I then execute Flight::redirect('/login', 303), Flight's code I linked to above will prepend the $base to the url I am redirecting to, turning the correct URL of /login into the incorrect /test/login. But what is the reason it should do that? I could understand if I were redirecting to Flight::redirect('login', 303) (note I've removed the leading slash). In that case, yes you would need to try to add some filepath information before the plain string "login". But in my case, I've already explicitly written the full path that I want to redirect to: /login. This is already usable as the value of a Redirect header, and doesn't need any $base to be prepended.

So, in the case that the $url being redirected to begins with "/" (or contains "://") shouldn't Flight just use the value as given, and not try to add a $base?

Flight, PHP and MySQL

Unfortunately the documentation for Flight is rather lacking, and I'm unable to figure out how to properly query a MySQL database using Flight.

<?php

# Includes #
require_once('flight/Flight.php');

# Database Information #
Flight::register('db', 'Database', array('localhost', 'database', 'username', 'password'));

# Queries #
Flight::route('/name/@name:[a-zA-Z]', function($name) {
        $db = Flight::db();
        $db->connect();
        return($db->query("SELECT * FROM active WHERE short_name LIKE '$name' LIMIT 0, 30"));
});

Flight::route('/address/@address:[a-zA-Z0-9]', function($address) {
        # mysql query using $address
});

?>

A preview of the database:
database

And this is what the script returns:
return

Anyone able to led some help?

Add sendHeaders in Response class?

It would be good to have a sendHeaders-method in Request so long running responses can send headers and do a flush flush(), so browsers receive initial data and do not timeout.

Filter "before" route method

Hi,

I'd like to check for HTTP method (get/post/delete/put/patch) and check for authentication. I thought this would work:

Flight::before('route', function(&$params, &$output){
    // check for a method
});

but it doesn't work. Any suggestions?

thanks,
-- buriwoy

$this in anonymous function

It is not possible to use $this from anonymous function before PHP 5.4.0.
I just ran into that problem.
Changing it in Engine.php on line 90 will make flight compatible with PHP 5.3 again:

$self = $this;
$this->loader->register('view', '\flight\template\View', array(), function($view) use($self) {
    $view->path = $self->get('flight.views.path');
});

Hooks for filtering request()->query and request()->data

Often I am finding myself having to encapsulate the request()->query in a cleaning function of my own. I would love to have the ability to attach filters to it so I don't have to keep doing something like this:

$clean = Security::clean(Flight::request()->data['someval']);

Support for error reporting

Why does parse errors not work with Flight? Include Flight and start it then place some random gibberish inside a route (or anywhere else) and the script just dies.

Suggestion, display errors and then die.

Even with error reporting E_ALL and display_errors on it behaves in the same way.

autoload class method

class Greeting {
public static function hello() {
echo 'hello world!';
}
}

Flight::route('/', array('Greeting','hello'));

the Greeting class it is better to be automatically loaded

PSR-0, composer and next release

Hi
Well this is not really an issue per se, but a "nice to have".

I was checking packagist (composer.json) for flight and saw that there was a master-dev version, but no release versions, even though I believe there is a release v0.1 and v0.2?

It would be nice to have a "stable" version on packagist even though it is only a beta, but master-dev isn't really stable at all. Could I encourage you to do a v0.3 release and put it on packagist?

Also I noticed that the autoloading on packagist was "files". That got me thinking, since flight is namespaced, it would require very few steps to make it PSR-0 compliant.

  1. remove the includes from Flight.php
  2. namespace Flight.php to flight
  3. put the files into a folder 'flight'
    edit
  4. Exceptions in Flight.php should be namespaced ''
    edit

Then for the packagist release, put something like (or whatever you prefer):
"autoload": {
"psr-0": {"flight": "/src"}
}

In examples and source files, it is easy to use flight as always, it just requires one extra line:

use flight\Flight;
Flight::map('blabla', ...)

PS: Thanks for a really great micro-php framework

/Thomas

htaccess public folder

My directory structure is the following:

public/
index.php
.htaccess
vendor/flight
.htaccess

The .htaccess in the root folder looks like this:

RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]

The .htaccess in the public folder looks like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

my url with .htaccess is http://localhost/myapp/index.php

my url without htaccess is http://localhost/myapp/public/index.php

all working fine but the flight not working.

Get rid of globals to allow for composing routes

Flight is really clean and nicely written, but it would be great if we could compose routes, rather than having them all defined at just the top level. For example, it could work like this:

image_api = Flight::api()

// route requests like: /images/birds/234
image_api::route('@category/@id')

api = Flight::api()
api::route('/images/*', image_api)

Flight::run(api)

In this way an application could be decomposed into a set of APIs, each one of which can be defined in its own way, with its own filters, etc...

Flight::request()->data based on content type

Hi there,

Have you ever considered to map Flight::request()->data key values based on request Content-Type.

This feature is useful in RESTful APIs, it adds an abstraction in Flight::request()->data and developer no needs to worry about the content-type of request

POST /api/user HTTP/1.1
Accept: application/json
Content-type: application/json
Content-Length: 10

{"id":100}
$request = \flight\net\Request ();
$request->data[id] == 100;

or maybe with new class

$request = \flight\net\RestRequest ();
$request->data[id] == 100;

I know that extending flight is so easy but I was wondering if you want to add it to flight's repo not.

Missing Parenthesis

I noticed a missing parenthesis in READ.me, Filtering section.

// Add an after filter
Flight::after('hello', function(&$params, &$output){
    // Manipulate the output
    $output .= " Have a nice day!";
});

Custom HTTP status with stop() or json()

Although it is not custom to have content with some of the HTTP status codes, many developers do return error messages and status information. It would be very useful to be able to use the Flight::json(..) with both content AND a status code. Same goes for the Flight::stop(..) function.

When simply adding these params to the methods, a strange behavior occurs. At some point the Request::status(..) methods is calls with an array as parameter..? I have worked around this, but it would be good if you could include this in the framework.

Thanks :)

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.