Support for absolute URLs


Sometimes I need to generate absolute URLs using CLI for example as a minion task. Normally (under web request) URL::base(TRUE, FALSE); will generate such url using $_SERVER[‘HTTP_HOST’];
I made a workaround in old Kohana by adding following piece of code to the URL::base method

if ($protocol === TRUE)
        // if commend line there will be no protocol
        if (PHP_SAPI == 'cli') {
            // Use the initial request to get the protocol
            $protocol = 'http';
            if ( ! isset($_SERVER['HTTP_HOST'])) {
			    $_SERVER['HTTP_HOST'] = Kohana::$config->load('site.default.http_host');
        } else {
            $protocol = Request::$initial;

Do you know a better way or are you planning to provide some more elegant support for such cases?


Thans for reaching us out with your problem / feature request.

We like the idea to implement a function for that in our minion module.

We created a Feature Request for that here. You will get any further information and updates to this topic there.

Thanks a lot :slightly_smiling_face:

closed #3