Answer the question
In order to leave comments, you need to log in
Zend expressive skeleton?
https://github.com/zendframework/zend-expressive-s...
Created with "AboutHandler.php", "AboutHandlerFactory.php" and "about.phtml" handles.
I wrote "routes.php" like this line "$app->get('/about', App\Handler\AboutHandler::class, 'about');".
Then I got into the config/autoload folder and opened the file "zend-expressive-tooling-factories.global.php", there I wrote
"return [
'dependencies' => [
'factories' => [
App\Handler\AboutHandler::class = > App\Handler\AboutHandlerFactory::class,
],
],
];"
I go to the browser and write zend.loc/about in the address bar and see my view.
And explain why you need AboutHandlerFactory, why you need a factory.
And, as it were, the second question, I created a module, when I access zend.loc/album/index, I get 404.
I put this "zendframework/zend-mvc": "3.1.1" because phpstorm was cursing.
And in composer I did this
"autoload": {
"psr-4": {
"App\\": "src/App/src/",
"Album\\": "module/Album/src/"
}
},
Answer the question
In order to leave comments, you need to log in
the factory is needed to create the object itself, with the help of the factory, any parameters or other objects from the service manager / storage are passed to your object or controller to the constructor, and if necessary, these objects will also be automatically created. In the settings, you say that in order to create your object, you need to call the factory.
On the second question - ZF3 can work as a middleware and as a classic MVC. For the Album package and similar ones, you also need to register it in the modules.config.php file so that ZF knows that this module exists and calls it during initialization. When displaying a 404 error, there is probably a message that is not right.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question