-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Build Libraries? #53
Comments
This is an excellent question and I agree that it would be nice to support this 👍 This project currently focuses on the Has anybody already looked into using phar-composer for library projects? Any input/feedback would be appreciated. One possible use case should probably work right now: require 'demolibrary.phar';
$demo = new Demo();
$demo->run(); We may also want to look into supporting the following use case: $demo = require 'demolibrary.phar';
$demo->run(); For this to work we would need to implement a mechanisms to allow the library author to specify what this should return. Again, #29 might be a good starting point here.
Indeed, and there's probably little we can do about this. IMO it would be sufficient to add some documentation (warnings) and leave this up the consumers of this project. |
I has! There are programmers who know a little about composer and want to use my package to , let say send SMS with. I thought your package can help. |
I used you package with a bit of hack to accomplish that. Let say you want to make a phar lib of foo/bar package.
This gives you a phar file that can be included and used as a library! There may be a simpler process, by the way. |
As far as I can tell this will lead to issues when you have more than one .phar built with phar-composer that you want to include, due to classes in the .phar being redeclared (for ex. the class |
@radford that is true. |
I don't know if it's the nicest way, but one possible solution would be to generate the class names at the time the file is built, with a suffix unique to each specific |
If you change the code from require 'demolibrary.phar'; to require 'phar://' . __DIR__ . '/demolibrary.phar/vendor/autoload.php'; It works perfectly fine with multiple phar files and with phar files that do not have a script (e.g. libraries) I use this successfully here: |
It looks like this project is meant to build an executable phar version of a project, like the Boris REPL. Can it also be used to build includable libraries?
It would be neat to be able to build a non-executable phar, with dependencies, for some given library and then be able to include that into a small or legacy project. The only rub I see is if multiple libraries are included this way that have overlapping dependency trees.
The text was updated successfully, but these errors were encountered: