Should PHAR createDefaultStub differentiate between CLI and browser?

Viewed 196

My question is about $indexfile and $webindexfile of createDefaultStub. My understanding was that $indexfile would be served up if the request is from the cli, and $webindexfile would be served up from a browser request.

I'm getting the same response ('backend') from either source, am I misunderstanding the behaviour? Or is my implementation wrong?

Thanks!

Directory Tree:

PHAR
+--app
    +--backend
        +--index.php //prints 'backend'
    +--frontend
        +--index.php //prints 'frontend'
+--build //destination for PHAR
+--build.php
+--index.php

/build.php

$phar = new Phar("build/app.phar", 0, "app.phar");
$phar->buildFromDirectory("./app");
$phar->setStub(
$phar->createDefaultStub(
    "backend/index.php", "frontend/index.php"
)

);

/index.php

include('phar://./build/app.phar');

From PHP manual:

createDefaultStub ([ string $indexfile [, string $webindexfile ]] )
1 Answers
Related