Skip to content
This repository has been archived by the owner on Dec 14, 2019. It is now read-only.

Custom shortcut #23

Closed
imam opened this issue Oct 25, 2017 · 12 comments
Closed

Custom shortcut #23

imam opened this issue Oct 25, 2017 · 12 comments

Comments

@imam
Copy link

imam commented Oct 25, 2017

First of all, this is brilliant! I would love to try this and I'm very optimistic that I'll use this a lot more than I'll use tinker!

Second, custom shortcut. Add methods to add shortcuts that we want to a service provider and boom! I don't really know what I'll make, maybe to create data faster? No idea yet. But really the possibility to do this would excite lots of people! Extendable tinker, that you can plug custom functions, default variable, custom classes, and more! How cool is that?

Great job for this package!

@ajthinking
Copy link
Collaborator

Thanks @imam :)

Actually you can do

Php artisan tinker --include myfile.php

This is whats utialized to enaeble tinx.
However, these includes are currently not passed through to the underlying tinker session. Finally I like the idea of easely putting more functions one might need in a easy way. What about using your own global helpers?

@ajthinking
Copy link
Collaborator

Just pushed to master so you can do:

php artisan tinx myfile.php alsothisfile.php

Just like in tinker. (scrap syntax in my above comment ).

I understand now this was not really what you asked for. I am not sure how that would work with the service providers? Guess thats mostly becaouse I am new to the concept of service providers. It sounds great though it would be nice with an example.

What do you say about this @furey ?

@furey
Copy link
Owner

furey commented Oct 26, 2017

Hi @ajthinking,

I agree that piping the "include" array through to Tinker (as you've just pushed to master) works perfectly, allowing users to easily inject whatever extra functionality they require on a per command basis… just as they can already with Tinker itself! 😊

To enhance this idea, I've just pushed to master the ability to set Tinker includes via config.

So now, a user can either pass their list of includes on a per command basis…

php artisan tinx include-1.php include-2.php

…or define them in their config file to be included every time they run tinx

<?php

// 'config/tinx.php'

return [

    // etc…

    'include' => [
        'include-1.php',
        'include-2.php',
    ],

];

Sweet?

🤓👍

@ajthinking
Copy link
Collaborator

Brilliant!!

@furey
Copy link
Owner

furey commented Oct 26, 2017

@ajthinking Ready for a v0.8?

@ajthinking
Copy link
Collaborator

@furey just relased v0.8! As collaborator, are you allowed to release, merge etc? If so, feel free to push releases you see fit! Its always very inspiring to see your code.

@imam
Copy link
Author

imam commented Oct 27, 2017

Sweet! But I'm still thinking that there should be a way to add a custom shortcut by adding some functions to a service provider would be awesome because people can actually add add-ons for this package, maybe like creating a search package to tinx or anything, adding something like Tinx::addFunction('search', function($params..) to their custom service provider, and boom, extendable Tinx that people can use just by requiring a package.

@imam
Copy link
Author

imam commented Oct 27, 2017

I'll try to do a pull request later just to show you what I meant :). If you think it's cool, we should reopen this issue so people can give it some thoughts and ideas for this concept

@ajthinking
Copy link
Collaborator

Wow @imam that idea is beyond beafutiful! Think I understand now. Its definitly a reopened issue :)

@ajthinking ajthinking reopened this Oct 27, 2017
@furey
Copy link
Owner

furey commented Nov 20, 2017

Hi @imam,

Have you had any further thoughts on this?

As mentioned previously in https://github.com/ajthinking/tinx/issues/23#issuecomment-339677755, I'm confident that passing your own include file(s) satisfies most use cases, but I'm happy to hear more if you have further to share!

If you're no longer thinking about it, please close the issue. 😊

Cheers!

@imam
Copy link
Author

imam commented Nov 25, 2017

Hi @furey

I do have some thoughts on this, but for the last 2-3 weeks, I've decided to take some breaks from work that's why I became silent :). Nevertheless, I want to work on a pull request for this feature, and I want to share it when it is 100% finished, it might take some time but I think it would be worth it :).

@furey
Copy link
Owner

furey commented Nov 26, 2017

Hi @imam,

Taking breaks from work every now and again is super important – good on you. 👍

I'm closing this issue in anticipation of your eventual PR.

If you never get around to it, that's okay – no pressure. But if and when you do… sweet!

Take it easy!

@furey furey closed this as completed Nov 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants