PHPackages                             winter/packager - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. winter/packager

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

winter/packager
===============

Run Composer commands within a PHP application

v0.4.3(9mo ago)91.1k↓33.3%2MITPHPPHP ^8.1CI passing

Since Jun 10Pushed 9mo ago4 watchersCompare

[ Source](https://github.com/wintercms/packager)[ Packagist](https://packagist.org/packages/winter/packager)[ GitHub Sponsors](https://github.com/wintercms)[ Fund](https://opencollective.com/wintercms)[ RSS](/packages/winter-packager/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (16)Used By (0)

Packager
========

[](#packager)

Run Composer commands and execute Composer searches and queries within a PHP application. This library acts as a PHP wrapper for Composer commands, allowing package management through PHP, and uses a combination of Composer, the Packagist API and your own project lockfile to derive information about the packages installed or available.

You technically *do not* need Composer to be installed, as this library will bring in the Composer application as a dependency - however, you will need Composer to install this library itself.

Use case
--------

[](#use-case)

This library was written initially to provide Composer usage through PHP for [Winter CMS](https://github.com/wintercms/winter), to power its upgrade and plugin architecture. A portion of the Winter CMS user-base prefer web-based installation methods and prefer not to (or simply can't) use the command-line Composer application.

This library therefore leverages the power of Composer in maintaining dependencies and does so in a way that can be programatically controlled and presented in a friendlier format for these users.

Installation
------------

[](#installation)

Install via Composer:

```
composer require winter/packager

```

Usage
-----

[](#usage)

This library currently provides support for the following Composer commands:

- `install`
- `search`
- `show`
- `update`
- `require`
- `remove`
- `version` **(--version)**

You can create a `Composer` instance in your PHP script and run these commands like so, defining a working directory which contains a `composer.json` file, and a home directory in which cached packages are stored.

```
