[#] Быстрое создание phar файлов используя Box
habrabot(difrex,1) — All
2016-01-12 16:00:03


![][1] `Phar` — это аналог `jar` из мира Java, но только применительно к PHP. `Phar` упаковывает файлы проекта в специальный архив и позволяет легко переносить и устанавливать приложение без манипуляций с самим проектом в виде исполняемой программы.

Phar archives are best characterized as a convenient way to group several files into a single file. As such, a phar archive provides a way to distribute a complete PHP application in a single file and run it from that file without the need to extract it to disk. Additionally, phar archives can be executed by PHP as easily as any other file, both on the commandline and from a web server. Phar is kind of like a thumb drive for PHP applications.



Для создания phar файлов в PHP существует [довольно развесистый API][2], но есть способ проще и удобнее — использовать проект [Box][3]. [][4]

## Формат JSON файла

Проект Box позволяет описать процесс создания phar файла в удобном JSON формате. Самый простой файл выглядит так:

{
"files": ["src/Put.php"],
"main": "bin/main",
"output": "example.phar",
"stub": true
}

[Читать дальше →][5]

[1]: https://habrastorage.org/files/2df/b9b/759/2dfb9b7599e94f9ba15455c55ff50c87.jpg
[2]: http://php.net/manual/en/book.phar.php
[3]: https://github.com/box-project/box2
[4]: #format-json-faila
[5]: http://habrahabr.ru/post/274745/#habracut