A CLI script that will fake a HTTP request before delegating control to another PHP script

0.1.2 2016-05-26 17:40 UTC

This package is not auto-updated.

Last update: 2020-03-20 17:33:57 UTC


This package provides an executable script that can be used with phpdbg to fake a web request.

Build Status


composer require lawngnome/phpdbg-fake-request


To fake a GET request to / with public/index.php as the entry point:

./vendor/bin/fake-request GET / public/index.php

This will launch phpdbg. The script can then be run with phpdbg's run command:


Populating $_GET and $_POST

The -g and -p options allow for GET and POST variables to be sent:

./vendor/bin/fake-request GET / public/index.php -g 'page=2'
./vendor/bin/fake-request POST / public/index.php -p 'page=2'

Values do not need to be URL encoded.


Similarly, the -H option allows for HTTP headers to be sent:

./vendor/bin/fake-request GET / public/index.php -H 'X-Foo: bar'


The -c option allows cookies to be sent:

./vendor/bin/fake-request GET / public/index.php -c 'PHPSESSID=foo'

Known issues

Arbitrary POST data is unsupported

It is impossible at present to set the php://input stream up at runtime, so non-form POST data is not supported.


Please send issues and pull requests through GitHub.


This builds on top of the excellent documentation on the phpdbg site and Symfony's equally excellent console component.

You can also e-mail me at, if you feel so inclined.