Kind of simple question, but I'm new to php and have spent too much time trying to google a simple question. I'm using php 5.6 and many guides (codeception, for example) talk about running a command like php vendor/bin/codecept.phar
. My files often don't have the extension and i don't need to use php
to execute them. Is this just something that evolved out of the language and is now optional?
A .phar
file is a compressed archive containing one or more PHP files:
The phar extension provides a way to put entire PHP applications into a single file called a "phar" (PHP Archive) for easy distribution and installation.
Source: http://php.net/manual/en/book.phar.php
There is no requirement to run it from the command line with php
, just as there is no requirement to run a .php
script from the command line with php
. As long as the file is marked executable and has an appropriate shebang it can be run as a standalone file.