- Php
- Features
- Autoload
- Class Reflection
- Magic Methods
- Exceptions
- Late Static Binding
- Type Hinting
- Spl
- Phpunit
- Phar
- Composer
- Guzzle
- Carbon
- Faker
- Math
- Requests
- Design Patterns
- Singleton Pattern
- Observer Pattern
- Strategy Pattern
- Registry
- Symfony
- Routes
- Annotations
- Flex
- Controllers
- Doctrine
- Templating
- Versions
- Php7.4
- Php8.0
- Modern Php
- Composer
- Slim Framework
- Autoloader
- Package
- Releases
- Generators
- Dependency Injection
- Middleware
- Framework
- App
- Http Foundation
- Front Controller
- Routing
- Render Controller
- Resolver
- Soc
- Frameworks
- Symfony V5
- Laravel V8
- Laminas V3 ♣
- Codeigniter V4
Laminas
MVC Skeleton Version: Laminas MVC 3.2 Create new laminas MVC project
cd /var/www/tests.local/php/laminas/
composer create-project -sdev laminas/laminas-mvc-skeleton myproject \
--ignore-platform-reqs
http://tests.local/php/laminas/myproject/public/
# Welcome page
http://tests.local/php/laminas/myproject/public/application/index
# Welcome page
Add new action helloAction
// module/Application/src/Controller/IndexController.php
// ...
public function helloAction()
{
$message = $this->params()->fromRoute('message');
return new ViewModel(['message' => $message]);
}
Add new route hello-world
// module/Application/config/module.config.php
// ...
'hello-world' => [
'type' => Segment::class,
'options' => [
'route' => '/hello[/:message]',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'hello',
'message' => 'World',
],
],
],
Add new view hello.phtml
// module/Application/view/application/index/hello.phtml
<div class="jumbotron">
<p>
Hello <?php echo $this->escapeHtml($message) ?>
</p>
</div>
It works!
http://tests.local/php/laminas/myproject/public/hello
# Hello World
http://tests.local/php/laminas/myproject/public/hello/Laminas
# Hello Laminas