Skip to content

miranj/craft-packages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 

Repository files navigation

Craft 2 Packages

Packagist server for Craft CMS 2 plugins, because why should Craft 2 miss out on all the Composer goodness?

Usage

  1. Create a composer.json file in the root folder of your Craft 2 project.

  2. Add the following to your composer.json

    {
      "repositories": [{
        "type": "composer",
        "url": "https://craft2packages.miranj.in/"
      }]
    }
    
  3. Use the standard composer require <vendor>/<package> command to add & install plugins that you wish to use with this project. You might have to specify a version constraint such as "1.*" to ensure you don't install a newer, Craft 3 version of the plugin.

    composer require aelvan/imager-craft:"1.*"
    

Contributing

Don’t see the plugin you want to use listed? Feel free to request inclusion, or better yet, add it yourself by submitting a pull request. Here's how:

  1. First, make sure that the Craft 2 version of the plugin you wish to add isn't already available via Packagist. Some popular plugins (e.g. SEOmatic) have been Composer installable all this while, so there is no need to duplicate them here.

  2. Add a new plugin inside satis.yml under repositories: with the following structure:

      aelvan/imager-craft:                      # <vendor>/<package-name>
        type: package
        package:
        - name: aelvan/imager-craft             # <vendor>/<package-name>
          description: Image transforms.        # Short description
          homepage: https://github.com/…        # Plugin home page
          version: 1.6.4                        # Latest Craft 2 supported version
          source:
            type: git
            reference: 1.6.4                    # Git reference (usually a tag)
            url: https://github.com/…           # Repository URL
    
  3. Figure out the installation method. There are two broad types:

    1. Plugins where the repository's root folder goes directly into /craft/plugins/. We can make use of Composer's native craft-plugin installer for this variant. Add the following to the package definition:

      type: craft-plugin
      require:
        composer/installers: "~1.0"
      extra:                          # optional
          installer-name: imager      # needed if plugin folder name differs from package name
      
    2. A subfolder inside the plugin repository needs to go into /craft/plugins/. We make use of a Composer plugin to copy the correct folder from the vendor directory to /craft/plugins/. Add the following to the package definition:

      require:
        sasedev/composer-plugin-filecopier: "^1.1"
      extra:
        filescopier:
          source: vendor/aelvan/imager-craft/imager   # vendor/<vendor>/<package>/<subfolder>
          destination: craft/plugins/imager           # craft/plugins/<subfolder>
      

You will find plenty of examples already inside satis.yml for the variants described above, as well as for things like adding multiple versions of a plugin.

Refer to the official Composer repositories docs for all the supported options and variations.

Built With

Acknowledgments

Releases

No releases published

Packages

No packages published