Git Product home page Git Product logo

samsonasik / errorheromodule Goto Github PK

View Code? Open in Web Editor NEW
50.0 6.0 6.0 1.56 MB

:gem: A Hero for your Zend Framework/Laminas, and Expressive/Mezzio application to log ( DB and Mail ) and handle php errors & exceptions during Mvc process/between request and response

License: MIT License

PHP 99.49% HTML 0.35% Twig 0.16%
error-handler zend-db logger zend doctrine zend-mail logging zend-expressive psr7 exception-handler

errorheromodule's Introduction

ErrorHeroModule

Latest Version ci build Code Coverage PHPStan Downloads

This is README for version ^5.0 which only support Laminas Mvc version 3 and Mezzio version 3 with php ^8.1.

For version ^4.0, you can read at version 4 readme which only support Laminas Mvc version 3 and Mezzio version 3 with php ^8.0.

Introduction

ErrorHeroModule is a module for Error Logging (DB and Mail) your Laminas Mvc 3 Application, and Mezzio 3 for Exceptions in 'dispatch.error' or 'render.error' or during request and response, and PHP E_* Error.

Features

  • Save to DB with Db Writer Adapter.
  • Log Exception (dispatch.error and render.error) and PHP Errors in all events process.
  • Support excludes PHP E_* Error (eg: exclude E_USER_DEPRECATED or specific E_USER_DEPRECATED with specific message) in config settings.
  • Support excludes PHP Exception (eg: Exception class or classes that extends it or specific exception class with specific message) in config settings.
  • Handle only once log error for same error per configured time range.
  • Set default page (web access) or default message (console access) for error if configured 'display_errors' = 0.
  • Set default content when request is XMLHttpRequest via 'ajax' configuration.
  • Set default content when there is no template service via 'no_template' configuration (Mezzio 3).
  • Provide request information ( http method, raw data, body data, query data, files data, cookie data, and ip address).
  • Send Mail
    • many receivers to listed configured email
    • with include $_FILES into attachments on upload error (configurable to be included or not).

Installation

1. Import the following SQL for Mysql

DROP TABLE IF EXISTS `log`;

CREATE TABLE `log` (
  `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` int(11) NOT NULL,
  `event` text NOT NULL,
  `url` varchar(2000) NOT NULL,
  `file` varchar(2000) NOT NULL,
  `line` int(11) NOT NULL,
  `error_type` varchar(255) NOT NULL,
  `trace` text NULL,
  `request_data` text NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

If you use other RDBMS, you may follow the log table structure above.

2. Setup your Laminas\Db\Adapter\AdapterInterface service or your Doctrine\ORM\EntityManager service config

You can use 'db' (with Laminas\Db) config or 'doctrine' (with DoctrineORMModule) config that will be transformed to be usable with Laminas\Log\Writer\Db.

<?php
// config/autoload/local.php
return [
    'db' => [
        'username' => 'mysqluser',
        'password' => 'mysqlpassword',
        'driver'   => 'pdo_mysql',
        'database' => 'mysqldbname',
        'host'     => 'mysqlhost',
        'driver_options' => [
            \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'',
        ],
    ],
];

OR

<?php
// config/autoload/local.php
return [
    'doctrine' => [
        'connection' => [
            'orm_default' => [
                'driverClass' => 'Doctrine\DBAL\Driver\PDO\MySql\Driver',
                'params' => [
                    'user'     => 'mysqluser',
                    'password' => 'mysqlpassword',
                    'dbname'   => 'mysqldbname',
                    'host'     => 'mysqlhost',
                    'port'     => '3306',
                    'driverOptions' => [
                        \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'',
                    ],
                ],
            ],
        ],
    ]
];

If you use other RDBMS, you may configure your own db or doctrine config.

3. Require this module uses composer.

composer require samsonasik/error-hero-module

4. Copy config

a. For Laminas Mvc application, copy error-hero-module.local.php.dist config to your local's autoload and configure it

source destination
vendor/samsonasik/error-hero-module/config/error-hero-module.local.php.dist config/autoload/error-hero-module.local.php

Or run copy command:

cp vendor/samsonasik/error-hero-module/config/error-hero-module.local.php.dist config/autoload/error-hero-module.local.php

b. For Mezzio application, copy mezzio-error-hero-module.local.php.dist config to your local's autoload and configure it

source destination
vendor/samsonasik/error-hero-module/config/mezzio-error-hero-module.local.php.dist config/autoload/mezzio-error-hero-module.local.php

Or run copy command:

cp vendor/samsonasik/error-hero-module/config/mezzio-error-hero-module.local.php.dist config/autoload/mezzio-error-hero-module.local.php

When done, you can modify logger service named ErrorHeroModuleLogger and error-hero-module config in your's local config:

<?php
// config/autoload/error-hero-module.local.php or config/autoload/mezzio-error-hero-module.local.php

use Laminas\Db\Adapter\AdapterInterface;

return [

    'log' => [
        'ErrorHeroModuleLogger' => [
            'writers' => [

                [
                    'name' => 'db',
                    'options' => [
                        'db'     => AdapterInterface::class,
                        'table'  => 'log',
                        'column' => [
                            'timestamp' => 'date',
                            'priority'  => 'type',
                            'message'   => 'event',
                            'extra'     => [
                                'url'          => 'url',
                                'file'         => 'file',
                                'line'         => 'line',
                                'error_type'   => 'error_type',
                                'trace'        => 'trace',
                                'request_data' => 'request_data'
                            ],
                        ],
                        'formatter' => [
                            'name' => 'db',
                            'options' => [
                                'dateTimeFormat' => 'Y-m-d H:i:s',
                            ],
                        ],
                    ],
                ],

            ],
        ],
    ],

    'error-hero-module' => [
	// it's for the enable/disable the logger functionality
        'enable' => true,

        // default to true, if set to true, then you can see sample:
        // 1. /error-preview page ( ErrorHeroModule\Controller\ErrorPreviewController )
        // 2. errorheromodule:preview command ( ErrorHeroModule\Command\Preview\ErrorPreviewConsoleCommand ) via
        //       php public/index.php error-preview
        //
        // for Mezzio ^3.0.0, the disable error-preview page is by unregister 'error-preview' from config/routes
        //
        //
        // otherwise(false), you can't see them, eg: on production env.
        'enable-error-preview-page' => true,

        'display-settings' => [

            // excluded php errors ( http://www.php.net/manual/en/errorfunc.constants.php )
            'exclude-php-errors' => [

                // can be specific error
                \E_USER_DEPRECATED,

                // can be specific error with specific message
                [\E_WARNING, 'specific error message'],

            ],

            // excluded exceptions
            'exclude-exceptions' => [

                // can be an Exception class or class extends Exception class
                \App\Exception\MyException::class,

                // can be specific exception with specific message
                [\RuntimeException::class, 'specific exception message'],

                // or specific Error class with specific message
                [\Error::class, 'specific error message'],

            ],

            // show or not error
            'display_errors'  => 0,

            // if enable and display_errors = 0, the page will bring layout and view
            'template' => [
                // non laminas-view (plates, twig) for Mezzio not need a layout definition
                // as layout defined in the view
                'layout' => 'layout/layout',
                'view'   => 'error-hero-module/error-default'
            ],

            // for Mezzio, when container doesn't has \Mezzio\Template\TemplateRendererInterface service
            // if enable, and display_errors = 0, then show a message under no_template config
            'no_template' => [
                'message' => <<<json
{
    "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
    "title": "Internal Server Error",
    "status": 500,
    "detail": "We have encountered a problem and we can not fulfill your request. An error report has been generated and sent to the support team and someone will attend to this problem urgently. Please try again later. Thank you for your patience."
}
json
            ],

            // if enable and display_errors = 0, the console will bring message for laminas-mvc
            'console' => [
                'message' => 'We have encountered a problem and we can not fulfill your request. An error report has been generated and sent to the support team and someone will attend to this problem urgently. Please try again later. Thank you for your patience.',
            ],
            // if enable, display_errors = 0, and request XMLHttpRequest
            // on this case, the "template" key will be ignored.
            'ajax' => [
                'message' => <<<json
{
    "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
    "title": "Internal Server Error",
    "status": 500,
    "detail": "We have encountered a problem and we can not fulfill your request. An error report has been generated and sent to the support team and someone will attend to this problem urgently. Please try again later. Thank you for your patience."
}
json
            ],
        ],

        'logging-settings' => [
            // time range for same error, file, line, url, message to be re-logged
	        // in seconds range, 86400 means 1 day
            'same-error-log-time-range' => 86400,
        ],

        'email-notification-settings' => [
            // set to true to activate email notification on log error event
            'enable' => false,

            // Laminas\Mail\Message instance registered at service manager
            'mail-message'   => 'YourMailMessageService',

            // Laminas\Mail\Transport\TransportInterface instance registered at service manager
            'mail-transport' => 'YourMailTransportService',

            // email sender
            'email-from'    => 'Sender Name <[email protected]>',

            // to include or not $_FILES on send mail
            'include-files-to-attachments' => true,

            'email-to-send' => [
                '[email protected]',
                '[email protected]',
            ],
        ],
    ],
    // ...
];

5. Lastly, enable it

a. For Laminas Mvc application

// config/modules.config.php or config/application.config.php
return [
    'Application',
    'ErrorHeroModule', // <-- register here
],

b. For Mezzio application

For laminas-mezzio-skeleton ^3.0.0, you need to open config/pipeline.php and add the ErrorHeroModule\Middleware\Mezzio::class middleware after default ErrorHandler::class registration:

$app->pipe(ErrorHandler::class);
$app->pipe(ErrorHeroModule\Middleware\Mezzio::class); // here

and also add error-preview routes in config/routes.php (optional) :

// for use laminas-router
$app->get('/error-preview[/:action]', ErrorHeroModule\Middleware\Routed\Preview\ErrorPreviewAction::class, 'error-preview');

// for use FastRoute
$app->get('/error-preview[/{action}]', ErrorHeroModule\Middleware\Routed\Preview\ErrorPreviewAction::class, 'error-preview');

to enable error preview page. To disable error preview page, just remove it from routes.

Give it a try!

Web Access

URl Preview For
http://yourlaminasormezzioapp/error-preview Exception
http://yourlaminasormezzioapp/error-preview/error Error
http://yourlaminasormezzioapp/error-preview/warning PHP E_WARNING
http://yourlaminasormezzioapp/error-preview/fatal PHP Fatal Error

You will get the following page if display_errors config is 0:

error preview in web

Console Access

You can use this module in laminas-cli, you can install:

composer require laminas/laminas-cli --sort-packages

then you can see the error-preview console:

Command Preview For
vendor/bin/laminas errorheromodule:preview Exception
vendor/bin/laminas errorheromodule:preview error Error
vendor/bin/laminas errorheromodule:preview warning PHP E_WARNING
vendor/bin/laminas errorheromodule:preview fatal PHP Fatal

You will get the following page if display_errors config is 0:

error preview in console

You can use the error handling in your console application, by extends BaseLoggingCommand, like below:

namespace Application\Command;

use ErrorHeroModule\Command\BaseLoggingCommand;
use Exception;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

final class HelloWorld extends BaseLoggingCommand
{
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        throw new Exception('some exception logged to DB');
    }
}

and register to your services like in the documentation.

For production env, you can disable error-preview sample page with set ['error-hero-module']['enable-error-preview-page'] to false.

Contributing

Contributions are very welcome. Please read CONTRIBUTING.md

errorheromodule's People

Contributors

samsonasik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

errorheromodule's Issues

Zend Test - "Test code or tested code did not (only) close its own output buffers" is thrown

What ZF application I'm using when issue happen ?

  • ^ZF2.5
  • [ * ] ^ZF3
  • Expressive 1
  • Expressive 2
  • Expressive 3

What PHP version you're using?

  • PHP 5.6
  • PHP 7.0
  • [ * ] PHP 7.1
  • PHP 7.2

What ErrorHeroModule version you're using?

  • ^1.0
  • [ * ] ^2.0

What Database you're using?

  • [ * ] MySQL version ...
  • PostgreSQL version ...
  • Other (please write DB name and version)

Expected behavior

When I test the application with zend-test (controller integration tests) I expect all the tests to run without any exceptions.

Actual behavior

It throws "Test code or tested code did not (only) close its own output buffers" by PHPUnit.

Steps/Codes to reproduce the behavior

Create a simple controller integration test using zend-test.

Wrong format of timestamp

What ZF application I'm using when issue happen ?

  • ^ZF2.5
  • ^ZF3
  • Expressive 1
  • Expressive 2
  • Expressive 3

What PHP version you're using?

  • PHP 5.6
  • PHP 7.0
  • PHP 7.1
  • PHP 7.2

What ErrorHeroModule version you're using?

  • ^1.0
  • ^2.0

Expected behavior

Write logs to database.

Actual behavior

Nothing happens in database once bug has been occured.

Explanation

Method $this->getDateTimeFormat() https://github.com/samsonasik/ErrorHeroModule/blob/master/src/Handler/Formatter/Json.php#L26 return timestamp in "c" format 2004-02-12T15:19:21+00:00 . On my preset Mysql requires "Y-m-d H:i:s"

Workaround

Change type of 'date' to text

error-hero-module downgrades from 2.16.0 to 2.3.0 when I update beberlei/assert to v3.1.0

What ZF application I'm using when issue happen ?

  • Expressive 3

What PHP version you're using?

  • PHP 7.1

What ErrorHeroModule version you're using?

  • ^2.0

What Database you're using?

  • MySQL version ...

Expected behavior

Not downgrading samsonasik/error-hero-module from 2.16.0 to 2.3.0.

Actual behavior

composer Downgrading samsonasik/error-hero-module (2.16.0 => 2.3.0)

Steps/Codes to reproduce the behavior

  1. Update beberlei/assert from v2.9.6 to v3.1.0 in composer.json file,
    while having samsonasik/error-hero-module (2.16.0)
  2. Run composer update

Example for MQTT implementation

Dear Abdul,

could you give an example how I can intregrate a MQTT writer to the logic. Maybe in the README.md?

I would support you If you give me a hint.

Thank you

Cheers

Pierre

PHP 8 throws Fatal Error in Logging.php when loading a Mezzio page via AJAX

What ZF/Expressive/Laminas/Mezzio application I'm using when issue happen ?

  • Mezzio 3

What PHP version you're using?

  • PHP 8.0

What ErrorHeroModule version you're using?

  • ^3.1

What Database you're using?

  • MySQL version 8.0

Expected behavior

no errors are thrown when loading a Mezzio page via AJAX

Actual behavior

PHP Fatal error: Uncaught TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, Laminas\Diactoros\PhpInputStream given in vendor\samsonasik\error-hero-module\src\Handler\Logging.php:120
Stack trace:
#0 vendor\samsonasik\error-hero-module\src\Handler\Logging.php(120): str_replace('\r\n', '', Object(Laminas\Diactoros\PhpInputStream))
#1 vendor\samsonasik\error-hero-module\src\Handler\Logging.php(192): ErrorHeroModule\Handler\Logging->getRequestData(Object(Laminas\Psr7Bridge\Laminas\Request))
#2 vendor\samsonasik\error-hero-module\src\Handler\Logging.php(227): ErrorHeroModule\Handler\Logging->collectErrorExceptionExtraData(Array, Object(Laminas\Psr7Bridge\Laminas\Request))
#3 vendor\samsonasik\error-hero-module\src\Middleware\Mezzio.php(78): ErrorHeroModule\Handler\Logging->handleErrorException(Object(ErrorException), Object(Laminas\Psr7Bridge\Laminas\Request))
#4 vendor\samsonasik\error-hero-module\src\HeroTrait.php(107): ErrorHeroModule\Middleware\Mezzio->exceptionError(Object(ErrorException))
#5 [internal function]: ErrorHeroModule\Middleware\Mezzio->execOnShutdown()
#6 {main}
thrown in vendor\samsonasik\error-hero-module\src\Handler\Logging.php on line 120

Steps/Codes to reproduce the behavior

With PHP 8.0.3 I used AJAX loading method
My code has this: <a href="#" onclick="$('#div_id').load('/proposal/form');">Load Form</a>

Note - going to /proposal/form URL directly loads the form just fine. The error only happens when I use AJAX link to load the form.
I am not sure if the error is related to AJAX specifically, but that is what I am observing at this time.

If the Ajax message is used, the HTTP response code shouldn't be 200

Dear samsonasik,

first thank you for your useful module.

I have just noticed something that bothered me a bit: if your module catches an error while doing an ajax call (the '$request->isXmlHttpRequest()' is a bit restricted as I would like to use it performing json calls but that's another story :) ), the ajax message set in the config is displayed as expected but with an 200 HTTP code. That's make difficult if not impossible to catch this failure at client side level.
Is there any way to change this and set a different HTTP code (500 would be the one IMO) ? And set as well a proper Content-type header (text/html at the moment which is not correct).

Regards,

Exceptions Listeners Priority

What ZF application I'm using when issue happen ?

  • ^ZF2.5
  • ^ZF3
  • Expressive 1
  • Expressive 2
  • Expressive 3

What PHP version you're using?

  • PHP 5.6
  • PHP 7.0
  • PHP 7.1
  • PHP 7.2

Expected behavior

It would be very nice if all error listeners were attached with last possible priority to allow the exceptions to be catched by other listeners. For example ZfcRbac throws Unauthorized exception and catches it by itself. I think that error-hero-module should be attached to catch exceptions that otherwise would be probably not catched at all.

Actual behavior

It attaches listeners with default priority.

Steps/Codes to reproduce the behavior

For example, you can install ZfcRbac and all Unauthorized exceptions will be catched by error-hero-module.

Mqtt enhancement

Hello,

I have developed an additional message transport via Mqtt for the ErrorHero Module.
Is a pull request welcome or do you think this is useless?

I have implemented it in the same way like the email feature.

Best regards,

Pierre

excluded errors are not excluded

What ZF/Expressive/Laminas/Mezzio application I'm using when issue happen ?

  • Laminas 3

What PHP version you're using?

  • PHP 8.1

What ErrorHeroModule version you're using?

  • ^5.0

What Database you're using?

  • Oracle 12

Expected behavior

I have added \E_DEPRECATED error as a value of the array 'exclude-php-errors' in the config file
so E_DEPRACATED errors should be ignored.

Actual behavior

E_DEPRECATED errors are still catched even if I have added \E_DEPRECATED error as a value of the array 'exclude-php-errors' in the config file.

Steps/Codes to reproduce the behavior

in \config\autoload\error-hero-module.global.php

        'exclude-php-errors' => [
            \E_USER_DEPRECATED,
            \E_DEPRECATED, // <--- add this
        ],

in index.php add this at the first beginning :

<?php $a = false; $a[] = 1;

execute index.php within your app in your browser.

the E_DEPRECATED error is catched by ErrorHeroModule.

display_errors setting being set to 1 does not show errors in browser.

What ZF application I'm using when issue happen ?

  • Mezzio 3

What PHP version you're using?

  • PHP 7.4

What ErrorHeroModule version you're using?

  • ^2.0

What Database you're using?

  • MySQL version 8.0

Expected behavior

Show exact error message in the browser, and log the error message in the error log.

Actual behavior

No error is shown, but my application has null values when I expect values. The exact error message is not shown explicitly even though effects of the error are evident by observing that my application is not working as expected.

Steps/Codes to reproduce the behavior

When in the hero config file I set ['display-settings']['display_errors'] to 0, the exact error of the application is written into the log, which is helpful in debugging the error. But when I set ['display-settings']['display_errors'] to 1, my application does not show explicit error in the browser, and no error message is written into the log, even though it is evident that my application is affected by the (unknown/unlogged) error.

Thus I feel like there is more to ['display-settings']['display_errors'] setting than I am aware of. What happens when ['display-settings']['display_errors'] is set to 1, because I do not see the error in the browser, or any of the logs.

Looking in the ErrorHeroModule code briefly it looks like the setting being 0 turns off ErrorHeroModule handling of the error and pushes it back to MVC module. I am not sure what it means, but it may explain why error is not logged, and why I may not be getting an error message displayed in my browser.

enable/disable error-preview page

currently, the sample error preview is always enable when module installed. It needs suppott for enable/disable error-preview page, like : "enable-error-preview-page" option

Ignoring errors suppressed by @

What ZF application I'm using when issue happen ?

  • ^ZF2.5
  • [v] ^ZF3
  • Expressive 1
  • Expressive 2
  • Expressive 3

What PHP version you're using?

  • PHP 5.6
  • PHP 7.0
  • [v] PHP 7.1
  • PHP 7.2

Expected behavior

Errors suppressed by @ should be ignored.
PHP Manual:
If you have set a custom error handler function with set_error_handler() then it will still get called, but this custom error handler can (and should) call error_reporting() which will return 0 when the call that triggered the error was preceded by an @.

Actual behavior

Errors suppressed by @ are being caught.

Steps/Codes to reproduce the behavior

Try to run @mkdir('somedir') on directory that already exists.

Keeping ErrorHandler::class in ZE3 pipeline.php hides descriptive error messages

What ZF application I'm using when issue happen ?

  • Expressive 3

What PHP version you're using?

  • PHP 7.2

What ErrorHeroModule version you're using?

  • ^2.0

What Database you're using?

  • MySQL version 8.0.11

Expected behavior

Upon a PHP error, show a meaningful descriptive error message from PHP, pointing to the root cause of web page malfunction. i.e. Fatal error: [description ... ].

Actual behavior

Browser displays the following message:

Oops!
This is awkward.

We encountered a 500 Internal Server Error error.

There are no further clues to the error message in the Apache error log. There is nothing in Mozilla's Developer Tools. Nothing seems to get logged via the ErrorHeroModuleLogger in the database table.

Steps/Codes to reproduce the behavior

In my pipeline.php I have the following:

$app->pipe(ErrorHandler::class); //Zend\Stratigility\Middleware\ErrorHandler
$app->pipe(ErrorHeroModule\Middleware\Expressive::class);

I suspect that whatever the error is, it gets eaten up by the ErrorHandler::class and the generic message above is displayed, hiding the real error description.

Potential Solution: Removing the ErrorHandler::class from pipeline.php uncovers the descriptive error and displays the full error message from PHP that I am looking for.

Summary

It seems to me that the line of $app->pipe(ErrorHandler::class) is the culprit in covering up descriptive error messages. Removing it resolves my immediate issue and shows me the descriptive errors I was looking for. Can ErrorHandler::class be removed? Must it remain in Expressive pipeline config and if yes can I still see descriptive error messages?

Refactor to allow more fatal error logging

Currently, some fatal error like :

Y cannot implement X - it is not an interface

still not logged. The code to reproduce is like below:

class X {}
class Y implements X { }

The fallback down of the error is on register_shutdown_function() call which when it is overlapped, it is not recorded by logging, as the code exited.

Integrating it into frameworks (zf-mvc and zf-expressive) is not as easy as imagined as it need to follow the dispatch flow.

The steps of refactor are as follow:

  1. move the display_errors check to early in process() or bootstrap event from the trait
  2. move the logging to phpErrorHandler() function
  3. "save" its flag "somewhere", and returns ( display as is ? ) Response instance.

It will require a big refactor, and I will do when I have a time โœŒ๏ธ

Cannot change layout

What ZF/Expressive/Laminas/Mezzio application I'm using when issue happen ?

  • Laminas 3

What PHP version you're using?

  • PHP 7.4

What ErrorHeroModule version you're using?

  • ^3.0

What Database you're using?

  • MySQL version ...

Expected behavior

I'd like to change layout template file.

Actual behavior

When I change
'template' => [
'layout' => 'layout/layout',

To:

'template' => [
'layout' => 'layout/error',

Does not change anything and it still call layout of my application

Can't update my composer since weeks

Hello! I have many projects with this module and I have problems with update my packages. I have tried to create a new Laminas project but it is not still work.
Also I tried to install specific 3.1.1 version (compatible with PHP 7).

`composer require samsonasik/error-hero-module
Using version ^3.1 for samsonasik/error-hero-module
./composer.json has been updated
Running composer update samsonasik/error-hero-module
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- laminas/laminas-diactoros[2.18.0, ..., 2.25.2] require php ~8.0.0 || ~8.1.0 || ~8.2.0 -> your php version (7.4.33) does not satisfy that requirement.
- Root composer.json requires samsonasik/error-hero-module ^3.1 -> satisfiable by samsonasik/error-hero-module[3.1.0, 3.1.1].
- samsonasik/error-hero-module[3.1.0, ..., 3.1.1] require laminas/laminas-diactoros ^2.0 -> satisfiable by laminas/laminas-diactoros[2.0.0, ..., 2.25.2].
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.17.0.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.14.0.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.6.0.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.4.1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.2.2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.2.1p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.2.1p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.2.1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.2.0p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.2.0p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.2.0.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.5p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.5p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.5.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.4p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.4p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.4.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.3p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.3p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.3.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.2p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.2p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.1p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.1p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.0p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.0p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.1.0.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.3p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.3p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.3.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.2p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.2p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.1p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.1p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.0p2.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.0p1.
- roave/security-advisories dev-master conflicts with laminas/laminas-diactoros 2.0.0.
- roave/security-advisories is locked to version dev-master and an update of this package was not requested.

You can also try re-running composer require with an explicit version constraint, e.g. "composer require samsonasik/error-hero-module:*" to figure out if any version is installable, or "composer require samsonasik/error-hero-module:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
`

What ZF/Expressive/Laminas/Mezzio application I'm using when issue happen ?

  • [X ] Laminas 3

What PHP version you're using?

  • [X ] PHP 7.4

What ErrorHeroModule version you're using?

  • [X ] ^3.0

What Database you're using?

  • [X ] MySQL version ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.