magento-hackathon / magento2-toolbar

Toolbar with developer and merchant functionality
Open Software License 3.0
28 stars 7 forks source link

php-debugbar #1

Closed barryvdh closed 8 years ago

barryvdh commented 8 years ago

Hey all,

Cool to see this. I was thinking about this yesterday also (during Meet Magento), but wasn't at the Hackathon, so started my own version today. Just came across this.

What I created is not based on the quickdevbar, but on https://github.com/maximebf/php-debugbar instead (which is cross-framework already). Not sure how this project will evolve after todays hackathon, but if you want, I'll rewrite (parts) of this toolbar here to use that. The structure seems rather similar already, and you don't have any collectors yet, right?

(Nothing against quickdevbar, but as I maintain both php-debugbar and https://github.com/barryvdh/laravel-debugbar which are both more popular, it might be better in long-term).

barryvdh commented 8 years ago

Okay I see @elzekool just pushed the design/sample collector, so probably should be better if I mentioned that earlier :P But still, architecture is still similar.

elzekool commented 8 years ago

Hi @barryvdh,

As promised, a more in depth response to your message. Directly after starting on the project idea we found out that a lot of people wanted a development toolbar for Magento, we found 3/4 implementations already, an issue on the Magento repo and a lot of discussion on the internet.

That came as a suprise to us, so it triggered a big discussion what to do, should we look at one implementation and suggest improvements for it, should we create a new toolbar, and if so what should it do.

In this discussion php-debugtoolbar and laravel-debugbar where view, and I must say that they are quite cool, so thank you for maintaining them!

But in the end we kind of went in a different direction. The toolbars that are present are really targeted at developers. But maybe a toolbar also can be useful for merchants, e.g. showing some extra product data not present at the current product detail page, like an explanation how the product price is calculated. This is there reason we've called our repository toolbar and not dev toolbar or something similar.

Our toolbar module has the following goals:

We've not made a choice if we use an existing toolbar as basis for the HTML/design, to have something presentable i've used parts of the Symfony toolbar

I just just saw that you made a PR for the issue that you described here, I don't know if we can use it, or parts of it. I definitively checking out how you solved some things, as for me personaly, this hackathon was the first real experience with Magento2, and still a lot to learn ;-)

barryvdh commented 8 years ago

Hey, thanks for your response :)

As far as I can see, using php-debugbar would not conflict with your goals, as they are still open custom collectors, the same as what you currently do. It also already has functionality to collect/store data in the background (using session or file storage for example), see http://phpdebugbar.com/docs/ajax-and-stack.html#stacked-data

But for me it was the same idea, I started reading into Magento2 module development and decided this would be a good thing to learn to use the Interceptors and DI system. But we both implemented that very similarly :)

As for you Merchant idea, I think that could be possible, but woud require some more UI work but could be interesting. Although to be honest, my focus is development, as that would be my actual use case ;) But because of Composer and the custom collectors, both should be possible.

elzekool commented 8 years ago

I see I have some reading to do, thank you for clarifying. I definitely have a look at PHP Debug Bar

barryvdh commented 8 years ago

I like the idea of using this as 'base', but I would not just leave it completely without collectors. Imho if it is to be popular, we should create some useful collectors first (in order to get usage at all and to set good examples). It could consist of core collectors where other modules could hook into or those who work with a default Magento installation.

It should however be configurable, eg. with configuration to enable/disable collectors and the toolbar entirely. (Eg. only on developer mode, restrict per IP etc, enable per collector/plugin). This core module should setup the basic structure for that (like admin tabs, helper functions).

I've pushed some collectors that might be useful to the PR.

aleron75 commented 8 years ago

Hi, great job @barryvdh, what a pity you couldn't be at the Hackathon.

elzekool commented 8 years ago

Hi @barryvdh,

I looked at the PHP Debugbar and I think we should use it. It already has al the requirements for a usefull toolbar, and with it being a non Magento open-source package people could get started on it very quickly, maybe even reusing them from other, non-magento projects.

The design at the moment is really focused on developers, looking a lot like firebug or the chrome developer tools. If you don't mind I would like to make it a bit more flat like, just like magento 2 is become.

I only disagree with including some default collectors in this package and allowing them to be disabled trough configuration. I think we should use the power of composer to fix this, in my idea we should build 3 packages:

  1. The basic toolbar package. This includes the integration of PHP Debugbar within Magento and some design to make it more Magento2 like. It could add some basic business logic for determining if the toolbar should be displayed.
  2. A package that adds some usefull collectors for Magento/PHP, we found https://github.com/vpietri/magento2-developer-quickdevbar to have some very powerfull features, and maybe we can combine them with the default collectors already present in PHP Debugbar
  3. A package with a very simple collector (a hello world collector) that shows how to build you own collector and integrate it with the toolbar.

For developers, you can say that they can install package 2 and then the toolbar is automatically installed trough the package dependencies, For non-developer usage people can use the example integration for developing their own extension.

If we don't go this way I'm afraid the toolbar is just yet an other toolbar, where people will judge it on the collectors present and not see it as an opportunity to create and share their own collectors.

But the above is just my personal opinion, maybe @aleron75, @jissereitsma, @avstudnitz or @BlackIkeEagle could give their opinion

barryvdh commented 8 years ago

Creating a seperate core + developer package would be also okay indeed :)

It's just that from my experience, 99% of the people will still only use the collectors that are provided, instead of building their own ones. (Although the magento could be different of course)

elzekool commented 8 years ago

Hi @barryvdh,

I've merged your PR, it's a good starting point, there are some DataCollectors in it now that should be moved out as we've discussed, but they can be left in as we continue to develop the base

barryvdh commented 8 years ago

Thanks! Could you consider adding me as a mainainer for this repositoy, in order to work with you on this plugin? (of course in deliberation with the rest)

avstudnitz commented 8 years ago

Added you to the team @barryvdh. Thanks for your work!

aleron75 commented 8 years ago

even if too late I would have given my "yes" :)

barryvdh commented 8 years ago

Thanks!

elzekool commented 8 years ago

Hi @barryvdh,

I see Andreas already added you ;-) Welcome to the team!