$ Composer create-project zendframework/Zend-expressive-skeleton expressive
After this, to check the result, I accessed the browser at the address http://localhost/expressive/public/ and got the following error:
Oops! This is awkward. We encountered the 404 Not Found error. You are looking is something that doesn' t exist or may have moved. Check out one of the links on this page or head back to Home.
The error message indicates that the page was not found, so, It looked like a PATH issue (way) for the files of the application.
Having a look around, I came to the conclusion that this happened because I didn't created the project directly in the root directory of publication (Ex: www/htdocs/), but in a subdirectory, that way: http://localhost/expressive/public/.
Anyway, It seems that the Expressive have any difficulty with Base Url / Base Path. In fact the very architecture of Zend Framework directory order of publication must be “public/“, so much so that if you run the Web Server pointing to “public/“, the application works normally.
Running the command “PHP-S 0.0.0.0:8080 -t public/” by terminal (command):
Taylor @ taylor-MINGW64 pc/c/wamp64/www/expressive $ PHP-S 0.0.0.0:8080 -t public/ PHP 7.0.10 Development Server started at Thu Aug 10 15:55:00 2017 Listening on http://0.0.0.0:8080 Document root is C:\wamp64\www\expressive\public Press Ctrl-C to quit. [Thu Aug 10 15:55:34 2017] 127.0.0.1:65106 : /expressive/public/
Now yes, doing this you can access http://localhost/expressive/public/ without any error.
But not to get that always point to “public/“, There is a Middleware Los/basepath solution outline. Installation is simple:
$ composer require Los/BasePath
After this, just add the Middleware such as one of the first in your application. For example, I put the call to the file “publicindex.php”, soon after “$app” have been initialized:
$app->pipe(new \LosMiddlewareBasePathBasePath('/expressive/public '));