Git Product home page Git Product logo

Comments (9)

LukeTowers avatar LukeTowers commented on July 19, 2024 1

@bennothommo ah, it's because Laravel parses installed.json itself:

https://github.com/laravel/framework/blob/9138b0b9e60df73e635f744085f0dae0a1c2f8ef/src/Illuminate/Foundation/PackageManifest.php#L133

We just need to override this in the October library, which is required anyways if we want to change its behaviour with a config value.

from debugbar-plugin.

LukeTowers avatar LukeTowers commented on July 19, 2024

@bennothommo does the don't discover section get properly merged in from just the plugin's composer.json? Why do we need it in the project root and in the plugin?

from debugbar-plugin.

bennothommo avatar bennothommo commented on July 19, 2024

@LukeTowers when I ran it with the Composer merge plugin, even with the "merge-extra" and "merge-extra-deep" options enabled, I couldn't get the Debug bar plugin to disallow discovery through the "extra" section - it would still discover the base package.

from debugbar-plugin.

bennothommo avatar bennothommo commented on July 19, 2024

The only extra section that is correctly parsed seems to be the root composer.json.

from debugbar-plugin.

bennothommo avatar bennothommo commented on July 19, 2024

@LukeTowers I found another way:

https://github.com/laravel/framework/blob/9138b0b9e60df73e635f744085f0dae0a1c2f8ef/src/Illuminate/Foundation/Application.php#L601

We can copy over this block to our Application class and condition the highlighted line with a check for the config value - it allows the package discovery to still work, but just simply doesn't load the discovered packages.

from debugbar-plugin.

LukeTowers avatar LukeTowers commented on July 19, 2024

@bennothommo good idea. I'm not 100% sold on the config file disabling of it by default yet though, I'm sure it might affect @adrenth & other @vdlp devs since they're usually gung ho about Laravel features.

from debugbar-plugin.

adrenth avatar adrenth commented on July 19, 2024

We developed a Vdlp.Developer plugin which we use internally in our agency. This plugin is shipped with the barryvdh/laravel-debugbar package. This package publishes a config file debugbar.php to the project config folder.

Also we require our own plugin vdlp/oc-developer-plugin in the "require-dev" section of composer.json. So it is never available on any testing/acceptance/production environment. It makes no sense by having debug packages/plugins installed there.

This default debugbar.php config file contains this line:

    /*
     |--------------------------------------------------------------------------
     | Debugbar Settings
     |--------------------------------------------------------------------------
     |
     | Debugbar is enabled by default, when debug is set to true in app.php.
     | You can override the value by setting enable to true or false instead of null.
...
'enabled' => env('DEBUGBAR_ENABLED', null),

So, it's enabled by default.

BUT...

All our projects have .env files by default and contain the DEBUGBAR_ENABLED environment variable. The only thin a developer needs to do is change this variable to enable or disable it:

DEBUGBAR_ENABLED = false|true

The intention of this plugin is having a debugbar in your project. So why disable it by default?

from debugbar-plugin.

LukeTowers avatar LukeTowers commented on July 19, 2024

@adrenth sorry for the confusion, we're talking about the Laravel package autodiscovery feature. We're considering disabling it by default in October and encouraging developers to manually load external packages' aliases and service providers from within their plugins instead so that we can properly prevent them from being loaded when the plugin (and thus the dependency) is present but disabled.

from debugbar-plugin.

bennothommo avatar bennothommo commented on July 19, 2024

Resolved by octobercms/library#492.

from debugbar-plugin.

Related Issues (20)

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.