-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load dynamically a composer dependency #146
Comments
That sounds like an awesome idea for a command. I probably wouldn't make it |
How about |
I like the idea of having composer in the name. Could also use packagist in the name since that's what it's using. Maybe |
Awesome! |
Current development of this issue here #152 |
Hello, what's the current state of this feature? ^^U |
The PR related to this feature is ready, @bobthecow decides when to ship it, in the meanwhile feel free to review the PR here => #152 |
As far as I can see, the code looks nice (I don't know how PsySH works internally). I understand the commands purpose, but if I obtain more info about where will be created the sandbox directories I can try to add those tests. I'm very interested in this feature because if it's combined with #121 , then it's possible to obtain something similar to the iPython Notebook , but with PHP (and probably more modular and flexible, but with less features). |
The #121 is still in a very premature state and it depends on a separate thread with a psysh server that has a execute method that runs some code and evaluates in return preserving the context, I was trying to use as few libraries as possible so the vendor folder doesn't gets all bluffed, anyways i will post the code i have until the moment. About the current issue, the libraries are created inside the temporary folder of each system, a call made by the sys_get_temp_dir function. If you write some tests would be very nice from you, I made the PR in a hurry without testing i am sorry about that. Anyways there is a little pending point i have to fix yet, the composer command still needs to have the composer file path, that might be a optional parameter in the configuration that if it is missing, then it must download the composer and BTW it will also need docs that will help the psysh user to not avoid this point if he already has composer installed. For that last step let me find some time to fix that. And finally one thing that i am not 100% sure about this PR, maybe this PR will ship as a separated plugin, there is a work in progress for that, all that information about this is here => #166 |
@Markcial if we ship this one as a separate plugin, it could actually add composer as a dependency for that plugin, right? |
Yes, it can be added as a dependency, downloaded as a phar file, or added via config parameter set by the plugin, whatever causes less trouble. |
Or even use Symfony's process component. :D |
LOL, that is true too :D |
True :) |
I don't really like this idea tbh, sorry. |
Refreshing a bit this issue, how about using https://github.com/sensiolabs/melody as an inspiration (not a direct dependency; we could even use that if it's installed) ? |
@Taluu I was working on this problem on a related project ( https://github.com/Litipk/Jupyter-PHP ) , I didn't push my code to the remote repository because it was completely experimental (and because my laptop was stolen with a ton of work 😢 ), but I can tell that I experimented two major problems:
I know that the context should be provided before, but I'll provide the context now: I was interested on dealing with composer dependencies through Jupyter-PHP commands to make easier creating super-portable PHP "notebooks" (we have a single file per notebook, so we need alternative ways to declare dependencies). |
Hi,
I was wondering if psysh could load on demand (and only for the current session) a composer dependency. For example (my last and freshest use case), I need to play around with Symfony's PropertyAccess component to make some tests.
Rather than setting up a blank project with this requirement (and go back to good old
php -r
or a test script), it would be a killer feature to have a command likeimport package/name
, and be able to play around with whatever was imported, limited to the current session : once the session is killed, the dependency would also be killed (maybe work on a /tmp directory ?)I know this is huge though...
The text was updated successfully, but these errors were encountered: