macfja / pharbuilder Goto Github PK
View Code? Open in Web Editor NEWCreate Phar of Composer based PHP application
License: MIT License
Create Phar of Composer based PHP application
License: MIT License
A PHP Notice
and a PHP Warning
are send if the autoload section is empty in the composer.json
file
Error on commit bf48160
Reading composer.json...PHP Notice: Undefined index: autoload in /home/you/PharBuilder/app/Utils/Composer.php on line 62
PHP Stack trace:
PHP 1. {main}() /home/you/PharBuilder/bin/phar-builder:0
PHP 2. include() /home/you/PharBuilder/bin/phar-builder:3
PHP 3. Symfony\Component\Console\Application->run() /home/you/PharBuilder/bin/phar-builder.php:20
PHP 4. Symfony\Component\Console\Application->doRun() /home/you/PharBuilder/vendor/symfony/console/Application.php:123
PHP 5. Symfony\Component\Console\Application->doRunCommand() /home/you/PharBuilder/vendor/symfony/console/Application.php:192
PHP 6. Symfony\Component\Console\Command\Command->run() /home/you/PharBuilder/vendor/symfony/console/Application.php:844
PHP 7. MacFJA\PharBuilder\Commands\Package->execute() /home/you/PharBuilder/vendor/symfony/console/Command/Command.php:259
PHP 8. MacFJA\PharBuilder\PharBuilder->__construct() /home/you/PharBuilder/app/Commands/Package.php:130
PHP 9. MacFJA\PharBuilder\PharBuilder->buildPhar() /home/you/PharBuilder/app/PharBuilder.php:126
PHP 10. MacFJA\PharBuilder\PharBuilder->readComposerAutoload() /home/you/PharBuilder/app/PharBuilder.php:143
PHP 11. MacFJA\PharBuilder\Utils\Composer->getSourcePaths() /home/you/PharBuilder/app/PharBuilder.php:354
PHP Warning: Invalid argument supplied for foreach() in /home/you/PharBuilder/app/Utils/Composer.php on line 86
PHP Stack trace:
PHP 1. {main}() /home/you/PharBuilder/bin/phar-builder:0
PHP 2. include() /home/you/PharBuilder/bin/phar-builder:3
PHP 3. Symfony\Component\Console\Application->run() /home/you/PharBuilder/bin/phar-builder.php:20
PHP 4. Symfony\Component\Console\Application->doRun() /home/you/PharBuilder/vendor/symfony/console/Application.php:123
PHP 5. Symfony\Component\Console\Application->doRunCommand() /home/you/PharBuilder/vendor/symfony/console/Application.php:192
PHP 6. Symfony\Component\Console\Command\Command->run() /home/you/PharBuilder/vendor/symfony/console/Application.php:844
PHP 7. MacFJA\PharBuilder\Commands\Package->execute() /home/you/PharBuilder/vendor/symfony/console/Command/Command.php:259
PHP 8. MacFJA\PharBuilder\PharBuilder->__construct() /home/you/PharBuilder/app/Commands/Package.php:130
PHP 9. MacFJA\PharBuilder\PharBuilder->buildPhar() /home/you/PharBuilder/app/PharBuilder.php:126
PHP 10. MacFJA\PharBuilder\PharBuilder->readComposerAutoload() /home/you/PharBuilder/app/PharBuilder.php:143
PHP 11. MacFJA\PharBuilder\Utils\Composer->getSourcePaths() /home/you/PharBuilder/app/PharBuilder.php:354
PHP 12. MacFJA\PharBuilder\Utils\Composer->readAutoload() /home/you/PharBuilder/app/Utils/Composer.php:62
Running
vendor/bin/phar-builder package composer.json
with PHP 7.0.3 results in
PHP Warning: Declaration of MacFJA\PharBuilder\Commands\Base::validateName($value, Symfony\Component\Console\Output\OutputInterface $output) should be compatible with Symfony\Component\Console\Command\Command::validateName($name) in /home/kelunik/GitHub/kelunik/acme-client/vendor/macfja/phar-builder/app/Commands/Base.php on line 289
PHP Fatal error: Uncaught Symfony\Component\Console\Exception\InvalidArgumentException: Incorrectly nested style tag found. in /home/kelunik/GitHub/kelunik/acme-client/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php:87
https://github.com/Modularr/Phar
https://github.com/kos33rd/pharaon
https://github.com/brad-jones/pharbuilder
https://github.com/index0h/yii2-phar
https://github.com/keradus/PharBuilder
https://github.com/JeroenDeDauw/PharBuilder
https://github.com/theseer/Autoload
https://github.com/crodas/Phar-Builder
I have a cli application which has a 4000+ php files in its vendor directory, and I find it lasts more then 2 minutes to compile all files into one phar file (PHP version 5.6, AMD A8-9600/ 16G Mem/ Ubuntu 16.04).
Then I read the source. I find that adding files one by one makes poor performance, this can be solved by using Phar::buildFromDirectory
or Phar::buildFromIterator
and compress once with Phar::compressFiles
.
I made a small change to the file app/PharBuilder.php
. (https://github.com/jiaojie1989/PharBuilder/blob/master/app/PharBuilder.php)
I just wonder if what I have done is ok? Please help me.
Thanks.
I tried to package this library https://github.com/kzykhys/Ciconia
Ended with this message:
[BadMethodCallException]
Entry src//Ciconia/Ciconia.php does not exist and cannot be created: phar error: invalid path "src//Ciconia/Ciconia.php" contains double slash
It was easy to fix, just had to remove the / after src in composer.json, but maybe it would be nice if this was handled automatically.
When added to the PHAR archive, the path to the stub file is an absolute path instead of a relative path.
This can lead to error if __DIR__
is used
Example:
> vendor/consolidation/robo/scenarios/symfony2/tests In PharBuilder.php line 515:
phar error: unable to open file "vendor/consolidation/robo/scenarios/symfony2/tests" to add to phar archive
The file vendor/consolidation/robo/scenarios/symfony2/tests
is a symlink, and the link in broken
The link you provided just reloads this repository
https://github.com/MacFJA/PharBuilder
No archive found there
Actually it's not possible to add files that are not in a sub directory (except for the entry file)
There is no PHAR for the latest release for download @ https://github.com/MacFJA/PharBuilder/releases/tag/0.2.5
PHP Fatal error: Uncaught exception 'Zend_Log_Exception' with message '"phar:///path/bin/main.phar/logs/run.log" cannot be opened with mode "a"' in phar:///path/bin/main.phar/vendor/zf1/zend-log/library/Zend/Log/Writer/Stream.php:81
Stack trace:
#0 phar:///path/bin/main.phar/configs/core.php(52): Zend_Log_Writer_Stream->__construct('phar:///path/b...')
#1 phar:///path/bin/main.phar/bin/cli.php(14): require_once('phar:///path/b...')
#2 /path/bin/main.phar(2): include('phar:///path/b...')
#3 {main}
thrown in phar:///path/bin/main.phar/vendor/zf1/zend-log/library/Zend/Log/Writer/Stream.php on line 81
Fatal error: Uncaught exception 'Zend_Log_Exception' with message '"phar:///path/bin/main.phar/logs/run.log" cannot be opened with mode "a"' in phar:///path/bin/main.phar/vendor/zf1/zend-log/library/Zend/Log/Writer/Stream.php:81
Stack trace:
#0 phar:///path/bin/main.phar/configs/core.php(52): Zend_Log_Writer_Stream->__construct('phar:///path/b...')
#1 phar:///path/bin/main.phar/bin/cli.php(14): require_once('phar:///path/b...')
#2 /path/bin/main.phar(2): include('phar:///path/b...')
#3 {main}
thrown in phar:///path/bin/main.phar/vendor/zf1/zend-log/library/Zend/Log/Writer/Stream.php on line 81
Refactor all output messages to respect the Symfony Console style cookbook.
This refactoring will drop the compatibility with symfony/console
2.6.
Phars can be used also as application served by webservers. In this case the shebang line is rendered on screen and this should be avoided in those (rare) cases.
Another possibility is to allow a custom stub.
When building the archive, require-dev
dependencies should be excluded or at least there should be a flag to do so.
vendor/bin/phar-builder package composer.json
interactively asks for a value even if it should run and use the default value if no "skip-shebang": false
is present.
Are there any plans to upgrade this project to version 3 of symfony console?
Due to
PharBuilder/app/Commands/Base.php
Line 380 in 8c348f4
I had trouble getting it set up and running on Travis-CI until I dug into the code and added some default values to the config in the composer.json
.
The following keys need to be set in the config to run headless, otherwise the check whether the script runs without IO prevents the default settings being used:
It would be great to find that information in the docs somewhere or prevent the check failing a headless build…
I have a dependency in my project which tries to check its own composer.json
file to get its version.
In PharBuilder.php
you specifically exclude composer files from the build.
Is / was there a specific reason for this and if not would you mind if I open a PR to allow for the composer.json file to be included into the build?
I guess it would be neat if it would be part of the configuration at some point, but for now I quick fix by just removing the line would work for me.
https://github.com/MacFJA/PharBuilder/blob/develop/docs/ComposerJsonOptions.md#full-example
shebang: false
dose nothing, you have to specify skip-shebang: true
.
https://github.com/MacFJA/PharBuilder/blob/develop/README.md#command-package
Some CLI options are renamed/missing: output
has to be output-dir
, no-dev
does not exist at all and so on.
Please consider adding a detached signature to the releases, so the validity of the release phar can also be verified. This would also allow installing phar-builder via phive.
It should default to the current directory if it contains a composer.json
when running vendor/bin/phar-builder package
.
Hi,
I've been attempting to install this project as a dev dependency but I cannot due to this being locked to Version 2.7+, 3.0+ of Symfony.
I'm inclined to submit a pull request, however in addition your sister project macfja/symfony-console-filechooser
is also hardcoded to support 2.7+, 3.0+, which makes it just that bit harder to work around.
(Plus, I do not know the source code of this project all that well so I am against bumping up versions of composer without say... running tests or something)
Thank you!
I am unable to run the utility.
Could you please point me to the correct direction to solve this?
I get the following exception:
[InvalidArgumentException]
The "src/Globals.php" directory does not exist.
But the file above exists! (src/Globals.php)
My composer.json file is:
{
"minimum-stability": "dev",
"name": "gevik/myapp",
"require": {
"php": ">=5.5.9",
"blendsdk/blendengine": "dev-engine2"
},
"autoload": {
"psr-4": {
"MyApp\\": "src"
},
"files": [
"src/Globals.php"
]
}
}
The method MacFJA\PharBuilder\Utils\Composer::removeFilesAutoloadFor
must be changed as it alter a project file without restoring its original content.
Right now I have those possibility to correct that:
composer
command to regenerate the file\Phar::addFromString
)Add the possibility to add a numeric signature to the Phar.
Task to do:
Official documentation:
Would be nice if it could run git describe --tags
optionally and define a version constant like PHAR_BUILDER_GIT_VERSION
. It would remove the need to always change a file before tagging a new release.
Might as well be done by using a script to release new versions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.