OpenMage / magento-lts

Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes! Download the source code for free or contribute to OpenMage LTS | Security vulnerability patches, bug fixes, performance improvements and more.
https://www.openmage.org
Open Software License 3.0
866 stars 436 forks source link

Added support for Laravel Ignition #3954

Closed fballiano closed 5 months ago

fballiano commented 5 months ago

Laravel Ignition is a pretty famous module for a better handling of error pages: https://flareapp.io/docs/ignition/introducing-ignition/overview

I thought it could be interesting for developers to have built-in, but absolutely optional (it's a pretty big package) in openmage.

The logic is:

If DeveloperMode is disabled or the spatie-ignition package is not installed, OM behaves as usual. It shouldn't introduce any performance degradation.

This is the error page for a PHP error (function doesn't exist):

Screenshot 2024-04-23 alle 13 25 13

This is the error page for a default PHP exception:

Screenshot 2024-04-23 alle 13 25 44

And this is a Mage::throwException:

Screenshot 2024-04-23 alle 13 25 58

How to test

  1. composer require "spatie/ignition" (as of 24 april 2024 you also need composer require laravel/serializable-closure)
  2. enable developer mode
  3. modify one of your files in order to generate an error
empiricompany commented 5 months ago

For those who want to try it immediately on latest v20.6.0

composer require "spatie/ignition"

add to your composer.json

"extra": {
    "enable-patching": true,
    "magento-force": true,
    "magento-core-package-type": "magento-source",
    "magento-root-dir": ".",
    "patches": {
        "openmage/magento-lts": {
            "Added support for Laravel Ignition #3954": "https://github.com/OpenMage/magento-lts/pull/3954.patch"
        }
    }
}

composer update

empiricompany commented 5 months ago

if i want to change theme here: settings this attempt to make this post request post

fballiano commented 5 months ago

yep I don't think this "save configuration" works at all

empiricompany commented 5 months ago

yep I don't think this "save configuration" works at all

I started a discussion on how to better implement the integration: https://github.com/OpenMage/magento-lts/discussions/3955

freekmurze commented 5 months ago

Hi there 👋 Ignition creator here! It's cool that you're considering using our error page in Magento.

I notice that this merge was already reverted. If I can help in any way with integration this in Magento let me know! All questions welcome.

empiricompany commented 5 months ago

Hi @freekmurze! Thank you for your awesome package! We've decided to integrate Ignition in OpenMage via an external package: https://github.com/empiricompany/openmage_ignition/

As developer of the package empiricompany/openmage_ignition, is it possible to obtain a developer license for Flare ? I am currently in the trial period, which expires in 10 days.

We've also opened a PR to list our module among the compatible platforms: https://github.com/spatie/ignition/pull/628

fballiano commented 5 months ago

Hi @freekmurze it's an honor to have you here, as @empiricompany was saying we created a much better solution to integrate Ignition in OpenMage in an external module , supporting Flare and OpenAI suggestions ;-)

freekmurze commented 5 months ago

@empiricompany I can give you a coupon so you can use Flare for free. Send a mail to support@flareapp.io if you'd like that coupon 👍

freekmurze commented 5 months ago

I think Magento 2 could also benefit from having Ignition as its error page. Unfortunately, I'm not that familiar with the Magento community where I should pitch that idea.

If you think the maintainers of Magento 2 might be interested, feel free to send them my way should they have questions.

fballiano commented 5 months ago

@freekmurze Magento2 already has this: https://github.com/swissup/module-ignition ;-)