Download the PHP package phine/phar without Composer

On this page you can find all versions of the php package phine/phar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phar

Phar

Build Status Coverage Status Latest Stable Version Total Downloads

A PHP library for creating and reading (without the phar extension) PHP archives.

Requirement

Installation

Via Composer:

$ composer require "phine/phar=~1.0"

Usage

Building an Archive

To create a new archive, you will need to create a new Builder instance. There are two ways of doing this: using an existing Phar instance, or by creating a new one.

With the new Builder instance, you will now have access to a few methods that appear to be identical to that of the Phar class:

Truth be told, they have the exact same end result as their Phar counterparts. The difference being that each method can be observed, and the arguments passed to each method can be altered before the actual action (adding an empty directory, adding a file from disk, etc) is performed. The simplest example is performing a search and replace to all content added using the addFromString() method.

Observing an Action

The Builder class is based on the phine/observer library, so it may benefit you to read up on the documentation provided by that library. To observe an action (aka "subject"), you will need to create your own implementation of Phine\Observer\ObserverInterface.

Now that we have our observer, we will need to register an instance of it with a builder event. In particular, we are interested in the Builder::ADD_STRING event, which is the event used by the builder for the addFromString() method.

With the observer registered to the addFromString() method, whenever we call it all occurrences of {name} will be replaced with the string world. So, if we add the following:

The message Hello, {name}! will be replaced with Hello, world!.

Available Events

There is one event for each archive related method:

As demonstrated in the example observer above, you can retrieve the arguments for each of these methods by calling the getArguments() method on the $subject that is provided. The name of the arguments are the same as the parameter names for the methods. You can find a complete list by viewing the API documentation.

Generating a Stub

The library provides a simple way of generating stubs for your archives. With the stub generator, you can incorporate the functionality provided by the Phar class, require files, or even embed some code to self-extract the archive if the phar extension is not installed.

The example above sets a banner comment, will set the stream alias to alias.phar, and will allow the archive to self-extract and run on machines that do not have the phar extension installed.

You will want to read the API documentation to understand all of the features that the stub generator provides.

Extracting an Archive

If the phar extension is not installed and you need to extract the contents of an archive, the Extract class will be your friend. It will use the archive parser to read the manifest and extract its contents to the directory of your choice.

Optionally, you may provide a callable as a second argument to extractTo(). The callable will receive an instance of Phine\Phar\Manifest\Entry, and will be used to determine if a file in the archive should be extracted.

In the example above, the callable will check if each file ends in .php. If the file does not end in .php, it will be skipped by returning true. Any other value returned will be ignored by the Extract class.

Verifying a Signature

If you need to verify the signature of an archive on a machine that does not have the phar extension installed, you will want to use the Signature class. If you need to verify archives that have been signed using a private key, you will still need the openssl extension.

Documentation

You can find the API documentation here. You may also be able to find tutorials, tips, and more on the wiki.

License

This library is available under the MIT license.


All versions of phar with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
phine/exception Version ~1.0
phine/observer Version ~2.0.0
phine/path Version ~1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phine/phar contains the following files

Loading the files please wait ....