All Projects โ†’ cbednarski โ†’ Pharcc

cbednarski / Pharcc

Licence: mit
A command-line tool that converts your php project into a .phar file

Labels

Projects that are alternatives of or similar to Pharcc

Php Console
๐Ÿ–ฅ PHP CLI application library, provide console argument parse, console controller/command run, color style, user interactive, format information show and more. ๅŠŸ่ƒฝๅ…จ้ข็š„PHPๅ‘ฝไปค่กŒๅบ”็”จๅบ“ใ€‚ๆไพ›ๆŽงๅˆถๅฐๅ‚ๆ•ฐ่งฃๆž, ๅ‘ฝไปค่ฟ่กŒ๏ผŒ้ขœ่‰ฒ้ฃŽๆ ผ่พ“ๅ‡บ, ็”จๆˆทไฟกๆฏไบคไบ’, ็‰นๆฎŠๆ ผๅผไฟกๆฏๆ˜พ็คบ
Stars: โœญ 310 (+1092.31%)
Mutual labels:  cli, phar
Mix Phar Skeleton
Phar command line program development skeleton
Stars: โœญ 81 (+211.54%)
Mutual labels:  cli, phar
Fluddy
๐Ÿค A dependency-free command line utility for managing, updating, creating and launching Flask Apps.
Stars: โœญ 23 (-11.54%)
Mutual labels:  cli
Create Osdoc App
create-osdoc-app cli
Stars: โœญ 26 (+0%)
Mutual labels:  cli
Chiasm Shell
Python-based interactive assembler/disassembler CLI, powered by Keystone/Capstone.
Stars: โœญ 24 (-7.69%)
Mutual labels:  cli
Html Table Cli
Create interactive tables from JSON on the command-line
Stars: โœญ 23 (-11.54%)
Mutual labels:  cli
Php Phar Compiler
A generic PHP PHAR compiler.
Stars: โœญ 24 (-7.69%)
Mutual labels:  phar
Github Spray
Draw on your GitHub contribution graph โ–‘โ–’โ–“โ–ˆ
Stars: โœญ 908 (+3392.31%)
Mutual labels:  cli
Devdash
๐Ÿฑ Highly Configurable Terminal Dashboard for Developers and Creators
Stars: โœญ 939 (+3511.54%)
Mutual labels:  cli
Git Praise
A nicer git blame.
Stars: โœญ 24 (-7.69%)
Mutual labels:  cli
Pol
pol /pษตl/ is a modern command line password manager with deniable encryption
Stars: โœญ 25 (-3.85%)
Mutual labels:  cli
Mprislyrics
Small command-line utility that displays lyrics in sync with the currently playing song in a MPRIS2 capable player.
Stars: โœญ 24 (-7.69%)
Mutual labels:  cli
Hed
vim like hex editor
Stars: โœญ 23 (-11.54%)
Mutual labels:  cli
Laminas Cli
Console command runner, exposing commands written in Laminas MVC and Mezzio components and applications
Stars: โœญ 25 (-3.85%)
Mutual labels:  cli
Life Commit
๐Ÿƒ๐Ÿ“† Life as a git. Commit on your life.
Stars: โœญ 919 (+3434.62%)
Mutual labels:  cli
Pyintelowl
Robust Python SDK and Command Line Client for interacting with IntelOwl's API.
Stars: โœญ 26 (+0%)
Mutual labels:  cli
Cliclick
macOS CLI tool for emulating mouse and keyboard events
Stars: โœญ 917 (+3426.92%)
Mutual labels:  cli
Iphone X Availability Node Cli
Check for iPhone X availability in-store near you using node.js
Stars: โœญ 23 (-11.54%)
Mutual labels:  cli
Stegify
๐Ÿ” Go tool for LSB steganography, capable of hiding any file within an image.
Stars: โœญ 927 (+3465.38%)
Mutual labels:  cli
Drucker
drucker: Drupal + Docker - Spin up Drupal, Lightning or BLT in seconds.
Stars: โœญ 26 (+0%)
Mutual labels:  cli

pharcc

pharcc is a command-line tool that converts your php project into a single, executable .phar file for easy distribution.

Build Status Roadmap Items

Installation

pharcc requires php 5.3+. You must also set phar.readonly = Off in your php.ini or you will be unable to compile .phar files.

Via .phar

The easiest way to get it working is to download a tagged pharcc.phar release, and put this on your path. For example:

$ wget https://github.com/cbednarski/pharcc/releases/download/v0.2.3/pharcc.phar
$ chmod +x pharcc.phar
$ sudo mv pharcc.phar /usr/local/bin/pharcc

Other ways

Composer (thanks @clue):

$ composer global require cbednarski/pharcc=dev-master
$ echo 'export PATH=$PATH:$HOME/.composer/vendor/bin' >> ~/.bash_profile

From source:

$ git clone https://github.com/cbednarski/pharcc
$ cd pharcc
$ make install      # For using
$ make install-dev  # For hacking

Usage

pharcc is a command-line tool that examines your project and produces a .phar file. cd into your project root and run the following:

$ pharcc init
$ pharcc build

You can also use pharcc as a library and call the internals directly, but if you do that I'm going to assume you're comfortable reading the code yourself. It's pretty short. Comments are welcome!

How it works

A phar is essentially a slew of php files that are concatenated together to create a single, executable php file, complete with assets and such. pharcc reads a .pharcc.yml file from the root of your project and, combined with some assumed conventions, builds an executable phar for you.

I assume the following:

  • You're using a PSR-0 project structure (more below)
  • Your app is a console application

Based on our assumptions, I've selected some sensible defaults for which files to include or exclude from your .phar file, which you can customize by editing the .pharcc.yml file. If your application is not a console app, you can omit main from the config.

Your Project Layout

I assume your project layout looks something like this, which is pretty standard for PSR-0 applications:

.
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ bin
โ”‚   โ””โ”€โ”€ pharcc
โ”œโ”€โ”€ composer.json
โ”œโ”€โ”€ readme.md
โ”œโ”€โ”€ src
โ”‚   โ””โ”€โ”€ cbednarski
โ”‚       โ””โ”€โ”€ Pharcc
โ”œโ”€โ”€ tests
โ”‚   โ””โ”€โ”€ cbednarski
โ”‚       โ””โ”€โ”€ Pharcc
โ””โ”€โ”€ vendor
    โ”œโ”€โ”€ autoload.php
    โ”œโ”€โ”€ cbednarski
    โ”‚   โ””โ”€โ”€ fileutils
    โ”œโ”€โ”€ composer
    โ”‚   โ”œโ”€โ”€ ClassLoader.php
    โ””โ”€โ”€ symfony
        โ”œโ”€โ”€ console
        โ”œโ”€โ”€ finder
        โ””โ”€โ”€ yaml

If your application doesn't look like this pharcc will probably still work, but you'll need to tweak your .pharcc.yml with some other appropriate includes / excludes.

Version Reporting

If your project is in git, uses semver tags for releases, and uses the symfony console component, pharcc can report the version of your application on the commandline. For example:

$ pharcc --version
pharcc version 0.2.3

To make this work in your app, you'll need to add cbednarski\Pharcc\Git::getVersion(__DIR__) to your bin file.

use cbednarski\Pharcc\Git;

$application = new Symfony\Component\Console\Application('pharcc', Git::getVersion(__DIR__));

Note: The current implementation is pretty magic, and only works if you worship the git, semver, and symfony console component gods.

Contributing

Contributions are welcome! Please don't hesitate to file a bug, pull-request a feature, or let me know what could be made easier to use.

Check out the list of ready-for-dev items here: Roadmap Items Here are some guidelines to follow:

  • The spirit of this project is to be simple and solve the general use case of creating phar files. It currently supports console applications and I'm willing to accept pull requests to add the ability to make a web app phar, like the one for phpMyAdmin, and a self-update command. Other large features, maybe. Get in touch.
  • If you file a bug please include steps to repro, or even better, link me to a git hash that's failing to compile properly (make sure it includes your .pharcc.yml file).
  • Code follows PSR-2 formatting rules. Use php-cs-fixer to reformat your code before you PR.
  • Use phpunit to run the unit tests and make sure they pass.
  • Please add tests if you add a feature or fix a bug.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].