Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development console #35

Merged
merged 7 commits into from
Feb 12, 2018
Merged

Development console #35

merged 7 commits into from
Feb 12, 2018

Conversation

thekid
Copy link
Member

@thekid thekid commented Feb 12, 2018

This pull request adds a development console, which is shown if any output is generated via output, echo or other PHP output functionality. It will show the output as well as the HTTP response generated from the code as seen below.

This enables var_dump()-driven development on an entirely new level.

Application

class Hello extends \web\Application {

  public function routes() {
    return [
      '/' => function($req, $res) {
        // var_dump($req->headers());
        $res->answer(200, 'OK');
        $res->send('Hello World', 'text/plain');
      }
    ];
  }
}

Regular request

image

Request w/ var_dump uncommented

image

Enabling the console

This console is enabled inside the development webserver, which is launched by passing -m develop. If developing inside Apache or PHP-FPM, install the development console by prepending the WEB_SOURCE environment variable pointing to the application class with +xp.web.dev.Console.

/cc @georg94 @mikey179

@thekid thekid merged commit 6fde8cf into master Feb 12, 2018
@thekid thekid deleted the feature/dev-console branch February 12, 2018 21:24
@thekid
Copy link
Member Author

thekid commented Feb 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant