PHPackages                             mpernia/phar-skeleton - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mpernia/phar-skeleton

ActiveProject

mpernia/phar-skeleton
=====================

A skeleton project to build a PHAR package in PHP

1.0.1(1y ago)05MITPHPPHP &gt;=8.2

Since Jan 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mpernia/phar-skeleton)[ Packagist](https://packagist.org/packages/mpernia/phar-skeleton)[ Docs](https://github.com/mpernia/phar-skeleton)[ RSS](/packages/mpernia-phar-skeleton/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Phar Skeleton
=============

[](#phar-skeleton)

 [ ![PHP 8.2](https://camo.githubusercontent.com/bb10fedc221b6c1332348766517deb06c0add6b5dd4c326a7f3130deb803c4af/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322d626c75652e7376673f7374796c653d666c6174266c6f676f3d706870266c6f676f436f6c6f723d7768697465266c6f676f57696474683d3230) ](https://www.php.net/) [ ![License MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667) ](https://github.com/mpernia/phar-skeleton/blob/main/LICENSE) [ ![Version 1.0.0](https://camo.githubusercontent.com/06d6b280d5ea9ece1814e76e22b8c99f50ff6c6e76a543d96498848143751bbd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f56657273696f6e2d312e302e302d6f72616e67652e737667) ](#)

**Phar Skeleton** is a simple starter project for building a `.phar` package in PHP.
This repository provides a basic structure to create, compile, and distribute your PHP application as a PHAR archive.

Contents
--------

[](#contents)

- [Requirements](#requirements)
- [Features](#features)
- [Project Structure](#project-structure)
- [Getting Started](#getting-started)
    - [Environment Variables](#environment-variables)
- [Usage](#usage)
    - [Build with Makefile](#build-with-makefile)
    - [Build with Composer](#build-with-composer)
- [Run or distribute the PHAR file](#run-or-distribute-the-phar-file)
- [Error Handling](#error-handling)
- [Contributing](#contributing)
- [License](#license)

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- PHP `phar.readonly` setting must be disabled
- `make` command available in your system

Features
--------

[](#features)

- Basic Composer configuration (type = "project").
- PSR-4 autoloading support.
- Simple build script example (`src/Example.php`).
- Example CLI script (`build/app.phar`).

Project Structure
-----------------

[](#project-structure)

```
.
├── .env               # Environment variables
├── Makefile           # Build automation
├── README.md          # This file
├── bin/
│   └── builder.php    # PHAR builder script
└── src/
    ├── index.php      # Main application file
    └── ...            # Other PHP source files

```

Getting Started
---------------

[](#getting-started)

1. **Install** this skeleton (via Composer or by downloading/cloning this repository).
2. **Customize** your package:
    - Update `composer.json` with your details.
    - Modify `src/` files to include your application logic.
    - Edit a file `.env` to set environment variables. ```
        BUILD_DIR=build
        PHAR_NAME=app.phar
        ```
3. **Build** your PHAR:
    - Run `composer compile` or directly `make`.
    - This will generate a `app.phar` file in the project.
    - The PHAR file will be created in the specified build directory (default: `./build/app.phar`).
4. **Run** or test your PHAR:
    - Run `php build/app.phar` or `build/app.phar` to execute the PHAR file.

### Environment Variables

[](#environment-variables)

- `BUILD_DIR`: Directory where the PHAR file will be created
- `PHAR_NAME`: Name of the output PHAR file

Usage
-----

[](#usage)

### Build with Makefile

[](#build-with-makefile)

The project includes a Makefile with several commands to help you build the PHAR file:

```
# Clean and build (recommended)
make all

# Only clean the build directory
make clean

# Only build the PHAR file
make build

# Show available commands
make help
```

### Build with Composer

[](#build-with-composer)

You can also use Composer to build the PHAR file:

```
composer compile
```

### Additional Makefile Commands

[](#additional-makefile-commands)

The following commands have been added to the Makefile:

- **check-index:** Ensures that the `public/index.php` file exists. If it does not, it creates the file with a default message.
- **docker-composer-install:** Runs `composer install` inside the Composer container to install dependencies.
- **docker-build-app:** Executes `make build` inside the application container to build the PHAR file.
- **dir-app:** Opens a bash shell in the application container for direct access to the app directory.

### Run or distribute the PHAR file

[](#run-or-distribute-the-phar-file)

- You can run the PHAR file directly:

    ```
    php build/app.phar
    ```

    Or:

    ```
    php build/app.phar
    ```
- You can also distribute the PHAR file to other machines or environments, so they can run the application without needing the full source.

Error Handling
--------------

[](#error-handling)

- If the `.env` file is missing or incomplete, the build process will show an error message with the required variables
- Build errors will be displayed with appropriate error messages and exit codes

Contributing
------------

[](#contributing)

Feel free to open issues or submit pull requests if you have any suggestions or improvements.

1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a new Pull Request

License
-------

[](#license)

MIT License. See the [LICENSE](LICENSE) file for more details.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance47

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~43 days

Total

2

Last Release

426d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f111c09ea14e06f615f8808083f76e9b5096d95cbd63400d3b5d857cf1f26425?d=identicon)[mpernia](/maintainers/mpernia)

---

Top Contributors

[![mpernia](https://avatars.githubusercontent.com/u/25876961?v=4)](https://github.com/mpernia "mpernia (4 commits)")

---

Tags

pharSkeletonproject

### Embed Badge

![Health badge](/badges/mpernia-phar-skeleton/health.svg)

```
[![Health](https://phpackages.com/badges/mpernia-phar-skeleton/health.svg)](https://phpackages.com/packages/mpernia-phar-skeleton)
```

###  Alternatives

[seld/phar-utils

PHAR file format utilities, for when PHP phars you up

875180.0M32](/packages/seld-phar-utils)[aplus/app

Aplus Framework App Project

5951.6M1](/packages/aplus-app)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
