urlencode for PHP and Javascript

urlencode() & rawurlencode()

PHP urlencode() use RFC 2396 and rawurlencode() use RFC 3986, the later should be the correct solution. BTW, the result of rawurlencode() and encodeURI() of javascript will be the same.


http_build_query use urlencode() by default, but could be changed by adding some more params:


Symfony Setup



By Composer:

Start PHP server


Change permission for PHP to write storage folder

Under /storage/app/public/ (laravel)


Overwrite Laravel Helpers

To control http / https related URL generators, some helpers must be overwritten.

Add param in .env:

Find helper file:



Ajax for JSON


Output JSON