DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for New achivements of Mezon PHP Framework - August 2022
alexdodonov
alexdodonov

Posted on

New achivements of Mezon PHP Framework - August 2022

Hi! Today I'am going to continue posting news about Mezon Framework improvements.

Mezon Router bugfix

In 1.5.x version the bug was fixed for routers wich return false. In previous versions of router false value was traited like 'Route handler was not foud' what was obviously buggy behaviour.

$router = $this->getRouter();
$router->addRoute('/catalog/[a:cat_id]/', function (): bool {
    return false;
});

// test body
$result = $router->callRoute('/catalog/foo/');
Enter fullscreen mode Exit fullscreen mode

Earlier this code caused exception but now is working fine.

Mezon Router refactoring

Lots of duplicate code was removed.

Non-ASCII parameters were implemented in the Mezon Router

Non-ASCII parameters were implemented as was requested in this issue. Now this code works fine:

$router = $this->getRouter();
RouterUnitTestUtils::setRequestMethod('GET');

$router->addRoute(
     'кирилличСский-ΡƒΡ€Π»/[s:non-ascii-param]',
     function (string $route, array $params): string {
          return $params['non-ascii-param'];
     },
'GET');

var_dump($router->callRoute(urlencode('кирилличСский-ΡƒΡ€Π»/Π½ΠΈ Ρ€Π°Π·Ρƒ Π½Π΅ ASCII - ζ—₯本θͺž')));
Enter fullscreen mode Exit fullscreen mode

The bug in the Mezon Template Engine was fixed

1 bug in the Mezon Template Engine was fixed. I already don't remember what it was about. Just be sure - now it is less buggy )

Top comments (0)

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.