F
F
ff0xff2019-02-05 15:01:02
symfony
ff0xff, 2019-02-05 15:01:02

Building symfony 4.1 into a phar package anyone have experience?

Building symfony 4.1 into phar package to work from console?
There are several console applications implemented on symfony, I want to build them as a phar package.
When assembling, I used box with this config

{
  "chmod": "0755",
  "directories": ["src"],
    "finder": [
        {
            "name": "*.php",
            "exclude": ["test", "tests"],
            "in": "src/vendor"
        }
  ],
  "main": "src/bin/console",
  "output": "hello.phar",
  "stub": true
}

Everything was assembled perfectly and without errors, but at startup
php hello.phar

I get an error
PHP Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "phar:///home/username/test/project/hello.phar/src/.env" environment file. in phar:///home/username/test/project/hello.phar/src/vendor/symfony/dotenv/Dotenv.php:54
Stack trace:
#0 phar:///home/username/test/project/hello .phar/src/config/bootstrap.php(25): Symfony\Component\Dotenv\Dotenv->load('phar:///home/us...')
#1 phar:///home/username/ test/project/hello.phar/src/bin/console(27): require('phar:///home/us...')
#2 /home/username/test/project/hello.phar(10) : require('phar:///home/us...')
#3 {main}
thrown in phar:///home/username/test/project/hello.phar/src/vendor/symfony/dotenv/Dotenv .php on line 54

I suspect that you just need a different assembly recipe. it's a framework.
Share a recipe? who collected?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
padlyuck, 2019-02-05
@ff0xff

try to explicitly shove it

{
    "chmod": "0755",
    "directories": [
        "src"
    ],
    "files": [
        ".env"
    ],
    "finder": [
        {
            "name": "*.php",
            "exclude": ["test", "tests"],
            "in": "src/vendor"
        }
  ],
  "main": "src/bin/console",
  "output": "hello.phar",
  "stub": true
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question