Download the PHP package nanbando/embedded-composer without Composer

On this page you can find all versions of the php package nanbando/embedded-composer. 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 embedded-composer

Embedded Composer

Embed Composer into another application.

Installation

Through Composer as dflydev/embedded-composer.

Why Would I Want To Embed Composer?

Imagine a console application shipped as a phar. If it is desired for the application to be extensible based on which directory it is in (say one set of plugins should be used in one directory but an entirely different set of plugins used in another directory) one cannot simply define a composer.json in both directories and run composer install.

Why not? Because the application shipped with a specific set of dependencies. Composer cannot add more dependencies without running the risk of introducing conflicts. The answer is to embed Composer into the application so that Composer can merge the dependencies already installed for the application with the dependencies defined in a specific directory's composer.json.

The end result is a set of dependencies that satisfy the directory specific requirements while taking into account the dependencies already installed for the console application.

While this is required for a phar distributed application this technique can be applied to any globally installed application that needs to be runtime extensible.

Usage

Basics

The following is an example bin/myapp style script that can be used either installed via Composer (vendor/bin/myapp) or installed globally (/usr/local/bin/myapp).

myapp.php (bin)

A shared block of code to initialize Embedded Composer from an application.

myapp (bin)

Example bin script (bin/myapp) that requires the shared block of code after it locates the correct autoloader.

myapp-phar-stub (bin)

Example phar stub (bin/myapp-phar-stub) that can be used to bootstrap a phar application prior to requiring the shared block of code.

What else ...

Find installed package by name

One can search for any package that Composer has installed by using the findPackage method:

Composer does not currently install the root package in the installed.json that represents the local repository. There is a PR out for this to be added to Composer core but until then the following workaround can be used.

Add the following post-autoload-dump script to the root package's composer.json:

This will write an additional repository to vendor/dflydev/embedded-composer/.root_package.json and Embedded Composer will automatically use it if it can be found. It is important to ensure that this file is a part of any phar built if the root package needs to be included in the distribution.

Create a Composer Installer instance

The Installer instance is suitable for processing install and update operations against the external configuration. It will take the internal (embedded) configuration into account when solving dependencies.

Create a vanilla Composer instance

License

MIT, see LICENSE.

Community

If you have questions or want to help out, join us in the #dflydev channel on irc.freenode.net.

Not Invented Here

Much of the work here has been supported by the Composer team and many people in #composer-dev.

The actual code started its life as a part of Sculpin and was spun out into a standalone project.


All versions of embedded-composer with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0.1
composer/composer Version ^2.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 nanbando/embedded-composer contains the following files

Loading the files please wait ....