Download the PHP package coenjacobs/mozart without Composer

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

Mozart Latest Stable Version License

Composes all dependencies as a package inside a WordPress plugin. Load packages through Composer and have them wrapped inside your own namespace. Gone are the days when plugins could load conflicting versions of the same package, resulting in hard to reproduce bugs.

This package requires PHP 8.0 or higher in order to run the tool. You can use the resulting files as a bundle, requiring any PHP version you like, even PHP 5.2.

Warning: This package is very experimental and breaking changes are very likely until version 1.0.0 is tagged. Use with caution, always wear a helmet when using this in production environments.

Installation

Mozart brings its own dependencies to the table and that potentially introduces its own problems (yes, I realise how meta that is, for a package like this). That's why installing Mozart in isolation, either through the Docker container, the available PHAR file or installing Mozart as a global dependency with Composer is prefered. In all cases, the configuration still needs to be placed in the composer.json file of the project iself.

Docker

Pull the Docker image from the registry:

Then you can start the container and run the mozart compose command in the container. In a single command:

Above command automatically adds the current working directory as a volume into the designated directory for the project: /project/. In the Docker container, Mozart is installed in the /mozart/ directory. Using the above command will run Mozart on the current working directory.

Please note that the Docker image for Mozart is only available starting from the latest build of version 0.7.0. The latest tag is always the latest build of the master branch and not a stable version. You can see all available tags on Docker Hub.

PHAR (via Phive)

Mozart can be installed via Phive:

Alternatively, the mozart.phar file can be downloaded from the releases page and then be run from your project directory:

Composer

To install Mozart and its dependencies, without conflicting with the dependencies of your project, it is recommended that you install Mozart as a global package, if you choose to install Mozart via Composer.

Global package

Using the global command when installing Mozart, it will be installed as a system wide package:

You can then find the bin file named mozart inside your ~/.composer/vendor/bin/ directory and run it from your project directory, referencing the full path to the bin file:

Development dependency of your project

You can install through Composer in the project itself, only required in development environments:

This gives you a bin file named mozart inside your vendor/bin directory, after loading the whole package inside your project. Try running vendor/bin/mozart to verify it works.

After configuring Mozart properly, the mozart compose command does all the magic:

Configuration

Mozart requires little configuration. All you need to do is tell it where the bundled dependencies are going to be stored and what namespace they should be put inside. This configuration needs to be done in the extra property of your composer.json file:

The following configuration values are required:

Important: Since Mozart automatically processes the full dependency tree of the packages you specify, you need to specify all these configuration options, because you can't reliably determine what kind of autoloaders are being used in the full dependency tree. A package way down the tree might suddenly use a classmap autoloader for example. Make sure you also include the namespace directory and classmap directory in your own autoloader, so they are always loaded.

The following configuration is optional:

After Composer has loaded the packages as defined in your composer.json file, you can now run mozart compose and Mozart will bundle your packages according to the above configuration. It is recommended to dump the autoloader after Mozart has finished running, in case there are new classes or namespaces generated that aren't included in the autoloader yet.

Scripts

Mozart is designed to install and be forgotten about. Using Composer scripts, the Mozart script can be run as soon as Composer either installs a new package, or updates an already installed one. This ensures that the packages you want to bundle, are always bundled in the latest installed version, automatically. These scripts also offer you the possibility to script dumping the autoloader, after Mozart is finished running:

When using Mozart through its Docker container, you can replace the "\"vendor/bin/mozart\" compose", lines with the actual commands you use to run the Docker container for your specific project. Running Mozart from inside the Docker container is really fast and shouldn't take more than a couple seconds.

Background and philosophy

Mozart is designed to bridge the gap between the WordPress ecosytem and the vast packages ecosystem of PHP as a whole. Since WordPress is such an end-user friendly focussed CMS (for good reasons), there is no place within the ecosystem where an end-user would be burdened with using a developers tool like Composer. Also, since WordPress has to run on basically any hosting infrastructure, running Composer to install packages from the administration panel (trust me, I've tried - it can be done) is a mission impossible to make it happen and compatible with every server out there.

But why make a new tool for this? There are other tools that enable you to do this, right? Yes, there are now. PHP-Scoper, for example. PHP-Scoper is a fantastic tool, that does the job right. But, PHP-Scoper wasn't available back when I started the Mozart project. Also, PHP-Scoper has a few limitations (no support for classmap autoloaders, for example) that were and are still quite common within the WordPress ecosystem. Finally, PHP-Scoper can be quite the tool to add to your development flow, while Mozart was designed to be simple to implement, specifically tailored for WordPress projects.

The key values of what's important to Mozart:

Mozart always has been and always will be geared towards solving the conflicting dependencies problem in the WordPress ecosystem, as efficiently and opinionated as possible. By being opinionated in certain ways and specifically focussed on WordPress projects, Mozart has quickly become easy to understand and implement.


All versions of mozart with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
symfony/console Version ^4|^5
symfony/finder Version ^4|^5
league/flysystem 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 coenjacobs/mozart contains the following files

Loading the files please wait ....