All Projects → EvolSoft → PharTools

EvolSoft / PharTools

Licence: MIT License
A powerful PHP-CLI tool to manage phar (PHP-Archive) files

Programming Languages

PHP
23972 projects - #3 most used programming language
shell
77523 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to PharTools

munin-indexer
A social media open post web archiving tool
Stars: ✭ 16 (-40.74%)
Mutual labels:  archiving
paperless-ng
A supercharged version of paperless: scan, index and archive all your physical documents
Stars: ✭ 4,840 (+17825.93%)
Mutual labels:  archiving
earkweb
E-ARK Web is a software for the creation and management of archival information packages, and it supports full-text search for individual files contained in them.
Stars: ✭ 18 (-33.33%)
Mutual labels:  archiving
whey
A simple Python wheel builder for simple projects.
Stars: ✭ 17 (-37.04%)
Mutual labels:  packaging
foreman-packaging
Packaging files (RPMs, debs) for Foreman and its dependencies
Stars: ✭ 38 (+40.74%)
Mutual labels:  packaging
fimfarchive
Preserves stories from Fimfiction
Stars: ✭ 15 (-44.44%)
Mutual labels:  archiving
lilac
Lilac is the build bot for archlinuxcn
Stars: ✭ 87 (+222.22%)
Mutual labels:  packaging
storytracker
Tools for tracking stories on news homepages
Stars: ✭ 47 (+74.07%)
Mutual labels:  archiving
minicon
Minimization of the filesystem for containers
Stars: ✭ 70 (+159.26%)
Mutual labels:  packaging
ts-engine
Power TypeScript packages and reduce your config overhead.
Stars: ✭ 102 (+277.78%)
Mutual labels:  packaging
comphar
Pack all composer dependencies into a single phar file.
Stars: ✭ 67 (+148.15%)
Mutual labels:  packaging
i7n-pdfhtml
pdfHTML is an iText 7 add-on for C# (.NET) that allows you to easily convert HTML and CSS into standards compliant PDFs that are accessible, searchable and usable for indexing.
Stars: ✭ 111 (+311.11%)
Mutual labels:  archiving
archivers-harvesting-tools
ARCHIVED--Collection of scripts and code snippets for data harvesting after generating the zip starter
Stars: ✭ 31 (+14.81%)
Mutual labels:  archiving
integration-test
ensure core packaging tools work well with each other
Stars: ✭ 15 (-44.44%)
Mutual labels:  packaging
pathofexile-flatpak
Path of Exile Flatpak
Stars: ✭ 11 (-59.26%)
Mutual labels:  packaging
wheelfile
🔪🧀 API for creating and inspecting Python .whl files (wheels).
Stars: ✭ 22 (-18.52%)
Mutual labels:  packaging
package-build
A toolset for building system packages using Docker and fpm-cookery
Stars: ✭ 36 (+33.33%)
Mutual labels:  packaging
pip-date
A simple CLI tool to show the installation/modification times of all your pip packages
Stars: ✭ 21 (-22.22%)
Mutual labels:  packaging
jasper
🧳 Single-binary packaging for Ruby applications that supports native and Wasm targets
Stars: ✭ 29 (+7.41%)
Mutual labels:  packaging
skype-bot-php
PHP CLI/Library for the Skype Bot API
Stars: ✭ 64 (+137.04%)
Mutual labels:  php-cli

start2

PharTools

PharTools is a powerful PHP command-line tool to manage phar (PHP-Archive) files. It allows to create, extract, edit and view phar archives. It also includes a simple API to implement PharTools features on your own scripts.

Features:

  • Create phar archives
  • Extract phar archives
  • Add, rename, delete, list files inside phar archives
  • Get informations about phar archives (such as filesize, metadata, stub, etc...)
  • Converts zip or tar archives to phar archives
  • Converts phar archives to zip or tar archives
  • Supports GZip and BZip2 compression types (BZip2 needs the php_bz2 extension which is already included on the Windows installer)

NOTE: to create phar files you need to set php.readonly to 0 in php.ini configuration

Requirements

  • At least PHP 5.3.0
  • Optional: php_bz2 extension (to implement BZip2 compression support)

Installation

You can download the PharTools packages at this page. You will find three download options:

All platforms:

PharTools_vx.x.zip (script only)

Windows:

PharTools_vx.x_win_installer.exe (preconfigured script + precompiled PHP binaries)
PharTools_vx.x_win_portable.zip (preconfigured script + precompiled PHP binaries, no installer)

Please note that precompiled PHP binaries included in the portable and installer pacakages are provided with minimal extensions and configuration

Windows

PharTools installation on Windows is very simple. You have three choices:

  • download the installer
  • download the Windows portable package
  • download the all-platforms zip package and configure PharTools manually

If choose the third option, you must simply edit the %PHP_PATH% variable in phartools.cmd file by setting a valid PHP executables path.

NOTE: if you install PharTools on Windows directories (like Program Files, Program Files (x86), ...) you may need administrator privileges in order to run the script correctly.

Linux

To install PharTools on Linux, download the all-platforms zip package. Then run:

$ ./phartools.sh

It should automatically install the PHP package (if missing) in order to run PharTools correctly or run PharTools directly. If you have problems while installing the PHP package, try to install it manually from your Linux distro package manager (i.e. apt-get).

macOS

You can run PharTools also on macOS. PharTools installation on macOS is very easy: you just need to download the all-platforms zip package. No PHP installation is required because PHP is already bundled with macOS since Mac OS X 10.0.0.

Usage

$ phartools -h

Usage:
  -a <phar_archive> <files> Add files to a phar archive
  -c <phar_archive> <files> [options] Create a phar archive
  -d <phar_archive> <file> Delete a file from a phar archive
  -e <phar_archive> [extract_path] Extract a phar archive
  -h Show this help screen
  -i <phar_archive> Show info about a phar archive
  -l <phar_archive> List the content of a phar archive
  -r <phar_archive> <oldname> <newname> Rename a file inside a phar archive
  -a2p <archive> [compression] Convert a zip or tar archive to a phar archive
  -p2a <phar_archive> [options] Convert a phar archive to a zip or tar archive

-a (add) command

Adds files to a phar archive.

$ phartools -a <phar_archive> <files>

Parameters:

<phar_archive> is the destination phar archive
<files> are the files you want to add (wildcards are allowed)

-c (create) command

Creates a phar archive.

$ phartools -c <phar_archive> <files> [options]

Parameters:

<phar_archive> is the name of the resulting phar archive
<files> are the source files to add inside the phar archive (wildcards are allowed)
[options] are optional switches:
	-zgzip|-zbzip2 Compress the phar file using gzip or bzip2 compression
	-m<metadata> Add metadata to the phar file (metadata format must be like 'key=>value,key2=>value2')
	-s<stub> Set stub string for the phar
	-r<regex> Include only files matching the regular expression

-d (delete) command

Deletes a file from a phar archive.

$ phartools -d <phar_archive> <file>

Parameters:

<phar_archive> is the destination phar archive
<file> is the file or the directory you want to delete

-e (extract) command

Extracts a phar archive.

$ phartools -e <phar_archive> [extract_path]

Parameters:

<phar_archive> is the destination phar archive
[extract_path] is an optional parameter specifying the path on which the phar archive contents will be extracted

-i (show archive info) command

Shows informations about a phar archive.

$ phartools -i <phar_archive>

Parameters:

<phar_archive> is the destination phar archive

-l (list archive content) command

Lists the content of a phar archive.

$ phartools -l <phar_archive>

Parameters:

<phar_archive> is the destination phar archive

-r (rename) command

Renames a file inside a phar archive.

$ phartools -r <phar_archive> <oldname> <newname>

Parameters:

<phar_archive> is the destination phar archive
<oldname> is the name of the file to rename
<newfile> is the new filename

-a2p (archive to phar archive) command

Converts a zip or tar archive to a phar archive.

$ phartools -a2p <archive> [compression]

Parameters:

<archive> is the zip or tar archive to convert
[compression] is an optional parameter specifying compression:
	gzip Compress the phar archive using gzip compression
	bzip2 Compress the phar archive using bzip2 compression

-p2a (phar archive to archive) command

Converts a phar archive to a zip or tar archive.

$ phartools -p2a <phar_archive> [options]

Parameters:

<phar_archive> is the destination phar archive
[options] are optional switches:
	-zgzip|-zbzip2 Compress the resulting archive file using gzip or bzip2 compression (zip archives do not support compression)
	-ozip|-otar Set the output archive format (zip or tar archive)

API

PharTools provides also an API to simplify the usage of phar archives:

include "path/to/phartools.php";

PharTools::<api_function>();

Screenshots

Windows

PharTools command-line interface
1
PharTools file list example
2

Linux

PharTools command-line interface
3
PharTools file list example
4

macOS

PharTools command-line interface
5
PharTools file list example
6

Donate

If you want you can support this project with a small donation by clicking 💵 here. Your generosity will help us paying web hosting, domains, buying programs (such as IDEs, debuggers, etc...) and new hardware to improve software development. Thank you 😄

Contributing

If you want to contribute to this project please follow the Contribution Guidelines.

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].