phpintervention

Installing Intervention Image without composer


I would like to test Intervention Image. It looks like a nice package. The installation instructions say:

The best way to install Intervention Image is quickly and easily with Composer.

The sentence above implies there's also a inferior, slower and difficult, way to install it. I assume the author is referring to an installation without Composer? That is exactly what I am looking for!

However, I am unable to find a way to do that. I have looked for an autoloader file, or even any autoload call in the code. There's none. No documentation either. It seems that only an installation with Composer is supported in a meaningful way.

Has anybody of you tried to use Intervention Image without resorting to Composer?


Solution

  • The way without Composer is simply to fetch the source from GitHub, move it in one off your vendor directories and load all needed files.

    As there's no autoload file provided inside the package, you have to extend your own autoload script or register a new autoload handler, as including each required file is a really annoying task.

    If you take a deeper look inside the composer.json file, you may notice inside the require section, that this package also need Guzzle. If you want to install Guzzle, you will again read the sentence "The recommended way to install Guzzle is through Composer". So you have to do the same thing again for Guzzle. This time you need the other two Guzzle dependencies psr7 and promises....

    At this point, I hope you build your autoloader robust enough to simply add only a new mapping from namespace prefix to path, as their might be many other required packages.


    If you don't want to include Composer directly inside your project, for what reasons ever, you could also create a empty Composer project, just for managing the dependencies and the autoloader. That might be easier to do everything by hand.

    Note: If you are lucky, you could use the Intervention/Image package without the Guzzle dependency.