kint-php / kint

Kint - Advanced PHP dumper
https://kint-php.github.io/kint/
MIT License
2.78k stars 292 forks source link

Research better config.php & custom parser support for composer users #94

Closed raveren closed 7 years ago

raveren commented 11 years ago

Related:

http://stackoverflow.com/questions/19738344/how-to-disable-kint-in-local-environment-under-laravel-4?noredirect=1#comment29401381_19738344

http://stackoverflow.com/questions/18751125/allow-users-of-an-opensourced-project-to-add-their-own-files-to-their-copy

ptim commented 11 years ago

I made an error in where I was looking for local package configs, should be: app/config/packages/author/package/environment/config.php

https://github.com/laravel/framework/issues/1255

ptim commented 11 years ago

Hmm.. I'm not sure if this is the ideal way to do it, but this works, and seems Laravel'ish:

// top of app/start/global.php
Kint::enabled(false);

and

// app/start/local.php
Kint::enabled(true);

(assuming you've got a local environment defined)

http://laravel.com/docs/lifecycle#start-files

isimmons commented 11 years ago

If I may suggest a start towards being laravelish, it would be great if there was a artisan command to publish the config to app/config and have kint check if that file exists.

Add to the conditional config check at the top of Kint.class.php to determine if the config has been published and if so, use it instead so developers don't have to touch anything in the Kint package.

Another thing is that dd() function overrides laravels built in dd() function. At the moment Laravels implementation of dd() works well in the cli but the kint version doesn't because it echos out html. I don't know how difficult it would be but if there were a way to detect if in Laravel and if in the cli to just used Laravels built in dd(), otherwise, use Kint's dd()

raveren commented 11 years ago

Hi guys,

First of all, I've done a heapload of changes to Kint in the WIP branch, one of them is the addition of proper CLI handling (I think I might not have pushed it yet, but it's already done) - with console coloring on UNIX and so on.

And secondly, the problem is, I hadn't had a chance to use Laravel yet - and priority number one of mine would be to not become platform-specific - so I need a generic solution to a problem I haven't encountered yet :) Thus, unless I receive a quality pull request, this is going to take me quite a bit of trouble and time, I'm afraid :/

aljinovic commented 11 years ago

Wouldn't it be better to make a bundle for Laravel, something like http://knpbundles.com/barelon/CgKintBundle for Symfony framework?

There are examples for some other frameworks also: http://raveren.github.io/kint/#integration

Kint could have configuration for naming short functions though, so situations like Laravel's existing dd() function can be avoided.

raveren commented 11 years ago

​Well, integration plugins are a very limited solution, they poorly handle updates and I'd much much prefer a generic solution, besides this issue as a whole is not - or was not inteded to be - Laravel-centric. After all, there's bound to be a best-of-both worlds solution.

I'm very aware of a need for customizing short functions, but am constantly carried away by more exciting features :) (for e.g. the latest and greatest automagic ajax handling). It's definitely coming though.

So for the time being this issue is deprioritised in favor of the feature heavy next stable pre-1.0 release, unless this gets a pull request until then, I'll have to learn some Laravel :) I've only heard positive things about it, so I'm even looking forward to it a little :)

isimmons commented 11 years ago

I'll be glad to look into possibilities for making it work with Laravel but stay framework agnostic if you like. I'm no expert but have been working with Laravel for about a year and have the basics of package building in Laravel down. Actually the 'artisan command' I mentioned is built into Laravel so I think the config file just needs to be in a certain location for it to work. Or it may be that the package needs to follow the PSR-0 loading structure. Not sure but will be glad to look into it and let you know.

jnvsor commented 7 years ago

Implemented in 2.x-dev. Please test and give feedback, thanks!