Laminas: MVC Framework for PHP – Book Review

Laminas: MVC Framework for PHP – Book Review

Selenium Testing Tools Cookbook - Book Cover
Guest post written by: Wojtek Marczak.
Put aside any PHP framework with MVC architecture which you used to work with just for a little moment and make a room for new pretender to the crown. Start to expect more from your framework, put less effort to do the same things as you used to before. How, you would ask? Ladies and gentleman, I present to you the Laminas MVC, the chosen one in web frameworks for the new 2020 era!

Pages 464
Publication Date 8th May 2020
Target Audience Intermediate
Author Adam Omelak
Category PHP, MVC framework, microservices

Covered Subjects

5/5

Let’s start this section with: this book isn’t for everyone. There is a good reason why it says: “Level: Intermediate” on the back cover.
So what does that really mean in terms of covered aspects of Laminas MVC? Well it means that book can less focus on learning a reader about PHP general concepts and the purpose of having a framework, and more on introducing crucial MVC aspects of Lamians and their true practical usage.

We have a whole spectrum of most vital components to be used in every MVC application. Starting from: getting to know core concepts like Event Manager, Service Manage, Configs and ending at Administration Panel with roles and Content Management System.

Writing Style

5/5

In its original version of “Zend Framework 3: Developer’s Guide” the book had quite a few errors, styling issues, wrong formatting and even grammar mistakes. Thankfully 2019 update has improved its quality. “Laminas: MVC Framework for PHP” because it’s based on ZF book is far more polished and checked.

The examples are batter explained and the previous gaps have been filled with comments, insights and even suggestion on how to extend and modify them.

Examples

4/5

Every single code used to create a functionality is printed in the book. This means that the reader can write as you read a working examples without a need for downloading a single chapters code. Which BTW can be viewed and cloned from GitHub repository.

It doesn’t matter that few chunks of code are not explained to the bottom because for most of there we can find additional comments in sample code chapters anyway.

Summary

4.5/5

It takes more than couple of months to usually write a single book, but this position has been written and improved for almost 3 years. A complete summary of what Laminas MVC can and will do with ease is on of the best starting resource to learn Laminas world for any developer who is open for new technology.

Give it a try and you might be surprised! (I am not just saying this because I used to work with Adam – the author of this book. This is my honest opinion).

Book reviewed by Wojtek Marczak.

Where to buy?

Laminas: MVC Framework for PHP - Book coverBuy Laminas: MVC Framework for PHP Book on Amazon

Rate this artcile
[Total: 7 Average: 4.6]
Please follow and like us:

6 thoughts on “Laminas: MVC Framework for PHP – Book Review

    • Yes, the book covers Laminas API Tools, in fact it covers full chapter for it. Unfortunately Mezzio is not in the scope of this paper.

  1. Cześć! Kupiłem książkę z niemieckiego amazona. Stosowałem się do kodu z książki, jako przykładu. Mam jednak jeden problem z sesją. Po dłuższym czasie nieaktywności, po odświeżeniu strony wyrzuca mi błąd: Application/src/Module.php w funkcji bootstrapSession($e) i problem dotyczy $session->start();

    Jak mogę to rozwiązać?

    i jeszcze zapisując sesję do katalogu .data/session/ z opcjami w pliku global.php
    ‘session’ => [
    ‘config’ => [
    ‘class’ => \Laminas\Session\Config\SessionConfig::class,
    ‘options’ => [
    ‘name’ => ‘session_www’,
    ‘cookie_httponly’ => true,
    ‘cookie_secure’ => true,
    ‘cookie_path’ => ‘/’,
    ‘cookie_domain’ => ‘domena’,
    ‘cookie_lifetime’ => xxx,
    ‘gc_maxlifetime’ => xxx,
    ‘save_path’ => APPLICATION_PATH .’/data/sessions’,
    ],
    ],
    ‘storage’ => \Laminas\Session\Storage\SessionArrayStorage::class,
    ‘validators’ => [
    \Laminas\Session\Validator\RemoteAddr::class,
    \Laminas\Session\Validator\HttpUserAgent::class,
    ],
    ]
    : przestaje działać csrf przy każdym formularzu.

    Jeśli będzie Pan pisał kolejny tego typu podręcznik (o Laminasie) to mam kilka uwag na temat tego co dodać, a powinno to pomóc każdemu, kto kupi książkę. Na swoim przykładzie mogę wskazać kilka rzeczy, które powinny zostać dodane, aby czytelnik miał lepszy obraz frameworka.

    Pozdrawiam!

    • Witam,

      Rzeczywiście w kodzie jest błąd, który pojawi się dopiero po wygaśnięciu sesji.

      Prostym sposobem na naprawienie całego tego błędu jest dodanie bloku try..catch tak jak poniżej:

      public function bootstrapSession($e)
      {
      $serviceManager = $e->getApplication()->getServiceManager();
      $session = $serviceManager->get(SessionManager::class);

      try {
      $session->start();
      $container = new Session\Container('initialized');
      } catch (\Laminas\Session\Exception\RuntimeException $e) {
      //session has expired
      return;
      }

Leave a Comment