laravel-console
laravel-console copied to clipboard
Deprecate in favor of artisan tinker
When I created this, there was nothing better to use, but now (and apparently some time in L4 too), there is artisan tinker
which is a core component of Laravel, and provides the same kind of functionality. You can run code from your app context with all files loaded, you have access to your models, you can run ORM queries...
With that in mind, I think I'd rather deprecate this project in favor of tinker.
But, I'm not using Laravel right now, and have no tinker experience, so if there is anyone in here that does, and has a valid reason why this shouldn't be deprecated, speak up :)
artisan tinker
is alright, but with L5, I feel like tinker
is a bit worse. In L4 I always used the console for trying various bits of code, whether it was trying to troubleshoot issues with a function or trying to come up with new code. Seeing the raw SQL queries also helped me debug quirks with relationships and streamline code. Also, I prefer the the nicer UI. :)
Laravel Console was an indispensable part of my dev process in L4.
but with L5, I feel like tinker is a bit worse
What? We tried to make it better?
Seeing the raw SQL queries also helped me debug quirks with relationships and streamline code. Also, I prefer the the nicer UI. :)
That's still possible in tinker in L5.
Definitely not a dig at you @GrahamCampbell. L5 is a much better experience overall for me compared to L4. I definitely appreciate the work you all put into L5.
I think my initial impressions were based on tinker closing (crashing?) after running some code when I first started with L5 after its official release. It got me frustrated, I ditched it, and found another way to solve my issue.
More than anything, I like how Console had everything laid out in a nice UI. You could quickly see SQL queries, query speed, etc. This probably the intended use case, but I used Console for experimenting: playing around with functions I've never used, trying to get a certain output with a specific input, breaking down code that had many steps in it to debug, etc.
I'm fairly new to coding in an framework and with PHP (~1.5 years), and my background is not coding. I just did things in ways that were easiest for me. Console was super convenient, so I avoided tinker
. If there are better (or recommended) ways to do these things, please let me know!
@GrahamCampbell yah. How do you work with queries in tinker? :)
I'd like to know how to:
- see the executed SQL queries
- see the time it took for each query
in the most simple way.
Hi there, I think a web based console is required for many purposes which tinker or any terminal based REPL can not replace. Let's me explain why:
- Tinker is just a REPL interface like ipython or ruby, nodejs.
- It has much faster to execute single or sequence lines of code as it is native and run directly as I can imagine.
- It is very hard to keep track of the flow for complex logic testing or you will need to keep your text editor beside to edit function and re-invoke it via tinker prompt.
- You might need to reload tinker when you change code, config. (not sure as I not tested this case yet).
- Web based console has a bit slower compared with native, but you can get many advantages by using web based such as:
- Execute pages of code for develop a new function or test the code logic without switch back and forth between text editor and web to refresh. It is very helpful when you use it to develop a big platform and data api logic layer.
- Use anywhere even on mobile, as you can not always reach the terminal or desktop to get tinker work. In case of quickly dev, the product is deploy in the remote server, and it will be hard to reach terminal via SSH for everyone, but it can be easily enable via web.
- Get more information like: SQL queries executed belong with submitted code, response / execute time, so you can easily analyze the performance effect with your code.
It is a quick comparison to tell you why. I hope you keep development it and even add some more awesome features like autocomplete and basic syntax error check.
P/S: I have has make some modification for local package to keep console work with L5, still has some issues but at least it's working :8ball:
@tiger2wander Well written :clap: @darsain If you don't have time to work on this package, maybe you can add some collaborators to your repository to maintain this project?
Ok. I'll be soon revisiting Laravel so I'll update this. I'd also love to add some contributors, but first I want to rewrite front-end, as currently it's a turd on a jQuery plate :)
@darsain I thought the UI worked just fine. Never had any issues at all. Really liked the color scheme as well.
@pauly4it yeah, but the code is horrible. It used to be a one-liner, and than evolved into a kinda more complexish app without any structural changes. Needs a rewrite.
The UI or how it works won't change.
+1 would love to see a L5 version of console. I use it all the time to copy/paste & test snippets of code.
I'd be happy to help on the backend part/L5 integration of the code if you need.
@darsain Any news? Because, since Laravel 5.0, php artisan tinker
uses PsySH and it doesn't work very well on Windows.
uses PsySH and it doesn't work very well with Windows.
It works fine on windows. I use windows evrey day.
@GrahamCampbell Really? Sometimes PsySH crashes for no reason and shell history doesn't persist across sessions. E.G. when I run this command:
echo "é";
It returns Exit: Ctrl+D
then the console crash. But I didn't press Ctrl+D
shorcut...
+1 for L5 version of console. Sometimes shell is not available on remote host, sometimes web UI is more convenient.
@plakhin :+1: for your comment :smirk_cat:
@tortuetorche https://github.com/teepluss/laravel-console
@plakhin Thanks, I already starred this repo some times ago :smile: