A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the vendor folder.

Overview

composer-custom-directory-installer

A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the vendor folder.

This is not another composer-installer library for supporting non-composer package types i.e. application .. etc. This is only to add the flexibility of installing composer packages outside the vendor folder. This package only supports composer package types,

https://getcomposer.org/doc/04-schema.md#type

The type of the package. It defaults to library.

Package types are used for custom installation logic. If you have a package that needs some special logic, you can define a custom type. This could be a symfony-bundle, a wordpress-plugin or a typo3-module. These types will all be specific to certain projects, and they will need to provide an installer capable of installing packages of that type.

How to use

  • Include the composer plugin into your composer.json require section::
  "require":{
    "php": ">=5.3",
    "mnsami/composer-custom-directory-installer": "1.1.*",
    "monolog/monolog": "*"
  }
  • In the extra section define the custom directory you want to the package to be installed in::
  "extra":{
    "installer-paths":{
      "./monolog/": ["monolog/monolog"]
      }
    }

by adding the installer-paths part, you are telling composer to install the monolog package inside the monolog folder in your root directory.

  • As an added new feature, we have added more flexibility in defining your download directory same like the composer/installers, in other words you can use variables like {$vendor} and {$name} in your installer-path section::
  "extra": {
    "installer-paths": {
      "./customlibs/{$vendor}/db/{$name}": ["doctrine/orm"]
    }
  }

the above will manage to install the doctrine/orm package in the root folder of your project, under customlibs.

Note

Composer type: project is not supported in this installer, as packages with type project only make sense to be used with application shells like symfony/framework-standard-edition, to be required by another package.

Comments
  • Can not seem to get working (probably a problem with my composer.json)

    Can not seem to get working (probably a problem with my composer.json)

    Here is my composer.json:

    {
      "name": "Frontier-CMS",
      "description": "The best Frontend Engineer package around",
      "require": {
        "mnsami/composer-custom-directory-installer": "*",
        "frontier-app/cockpit": "*"
      },
      "extra":{
        "installer-paths":{
          "./admin/": ["frontier-app/cockpit"]
        }
      }
    }
    

    When I run composer install it just installs everything to the vendor/ folder.

    opened by chopfitzroy 13
  • Issue with components install

    Issue with components install

    Hi, first, thanks for your work. I am making some tests, and the installer works in a half, the components (jquery, jqueryui, font-awesome) has been installed on vendor directory, bootstrap, bootstrap-sass and datatables are installes as i expected, in root/resources, could you help me to find the error? if i can fix this, i will not require to use bower or anything else :)

    here is my composer.json "require" : { "php": ">=5.3.0", "mnsami/composer-custom-directory-installer": "1.0.*", "components/jqueryui" : ">=1.11.4", "components/font-awesome" : "dev-master", "twbs/bootstrap-sass" : ">=3.3.5", "twbs/bootstrap" : "~4.0", "datatables/datatables" : ">=1.10.9" }, "config": { "preferred-install": "dist" }, "extra": { "installer-paths": { "public/resources/components/jqueryui": ["components/jqueryui"], "public/resources/components/font-awesome": ["components/font-awesome"], "public/resources/bootstrap": ["twbs/bootstrap"], "public/resources/bootstrap-sass": ["twbs/bootstrap-sass"], "public/resources/datatables": ["datatables/datatables"] } },
    "minimum-stability": "dev", "prefer-stable": true

    Thank you

    opened by hstanleycrow 9
  • Not working for me - sorry.

    Not working for me - sorry.

    Hi,

    i would take this composer-plugin to change the install-paths from my local packages - but i retrieve always this message:

    Your requirements could not be resolved to an installable set of packages.

    Problem 1 - The requested package mnsami/composer-custom-directory-installer could not be found in any version, there may be a typo in the package name.

    Potential causes:

    • A typo in the package name
    • The package is not available in a stable-enough version according to your minimum-stability setting see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.

    Have you any idea?

    Thanks and best regards frusti

    opened by ghost 6
  • Might you want to add this to packagist?

    Might you want to add this to packagist?

    Thank you for writing this. Mind adding it to packagist.org? (Perhaps after renaming it to something more sane, e.g. "mnabil/composer-installer-plugin"?)

    opened by ddebernardy 6
  • Does not remove package from custom directory

    Does not remove package from custom directory

    Hi,

    Can you confirm that composer should remove a package installed with this installer, if it was removed from the composer.json within the "require" section?

    It seems that composer is not removing the custom package directory that was installed with this installer.

    Thanks for your help!

    Regards,

    Carlos

    opened by carlos-reynosa 5
  • Configuration with composer.json fails

    Configuration with composer.json fails

    I cannot install the package as described in the readme.md. I get the following output from "composer install":

    " Loading composer repositories with package information Installing dependencies (including require-dev)
    Your requirements could not be resolved to an installable set of packages.

    Problem 1 - The requested package mnabil/composer-custom-directory-installer could not be found in any version, there may be a typo in the package name.

    Potential causes:

    • A typo in the package name
    • The package is not available in a stable-enough version according to your minimum-stability setting see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.

    Read http://getcomposer.org/doc/articles/troubleshooting.md for further common problems. "

    Maybe it could be a Problem caused by https://github.com/mnabil/composer-installer-plugin/commit/fcd45b4811c4a1bf38da8ceb8641fbd571057bc4?

    opened by d3mo17 5
  • [Enhancement] Implement a new variable {$version}

    [Enhancement] Implement a new variable {$version}

    As with {$vendor} and {$name}, I would like to see a {$version} variable that will have the version of the package installed so that the following configuration:

        "extra": {
            "installer-paths": {
                "./libraries/{$name}-{$version}": ["vendor/pkgname"]
            }
        }
    

    Will result in installing the package to the following directory:

     /libraries/pkgname-1.0.0
    
    opened by ZaDarkSide 4
  • Problems with composer-custom-directory-installer

    Problems with composer-custom-directory-installer

    Hi @mnsami, Fisrt of all thanks for your work! I'm trying to use your installer and I have some problems. With that composer.json everything works OK:

    {
        "name": "test/testign",
        "description": "Tetsting",
        "repositories": [
            {
                "type": "vcs",
                "url": "[email protected]:mnsami/composer-custom-directory-installer.git"
            }
        ],
        "require": {
            "php": ">=5.3",
            "mnsami/composer-custom-directory-installer": "1.0.*",
            "monolog/monolog": "*"
        },
        "extra": {
            "installer-paths": {
                "./monolog/": ["monolog/monolog"]
            }
        },
        "minimum-stability": "dev"
    }
    

    The monolog library was placed in the ./monolog directory as expected. But, if I use my own repo, it doesn't place the pablor/test-library inside the ./monolog directory.

    {
        "name": "test/testign",
        "description": "Testing",
        "repositories": [
            {
                "type": "vcs",
                "url": "[email protected]:mnsami/composer-custom-directory-installer.git"
            },
            {
                "type": "vcs",
                "url": "https://github.com/pablor/test-library"
            }
        ],
        "require": {
            "php": ">=5.3",
            "mnsami/composer-custom-directory-installer": "1.0.*",
            "pablor/test-library": "*",
            "monolog/monolog": "*"
        },
        "extra": {
            "installer-paths": {
                "./monolog/": ["pablor/test-library"]
            }
        },
        "minimum-stability": "dev"
    }
    

    Any idea about waht I'm doing wrong? Thanks!

    opened by pablor 4
  • Composer 2 Compatibility

    Composer 2 Compatibility

    as far as i can see we only need to update the plugin classes here to support plugin api v2

    but pear installer is removed in v2

    see https://github.com/composer/composer/issues/8726 for more infos

    edit: would be great to have a release after we reach compatibility :)

    opened by chr-hertel 3
  • Libraries.io version is out of sync

    Libraries.io version is out of sync

    Last version on Libraries.io is 1.1.0 .. it could be something related to #19 .. I don't know

    This makes dependent project to see their dependencies out-of-date ;(

    opened by drAlberT 3
  • Incompatibility with wikimedia/composer-merge-plugin

    Incompatibility with wikimedia/composer-merge-plugin

    Hello

    The merge process of the composer-merge-plugin is probably happening after this plugin, meaning it doesn't get the merged json from merge-plugin.

    https://github.com/wikimedia/composer-merge-plugin

    Similar behavior with drupal-libraries-installer-plugin: https://github.com/generalredneck/drupal-libraries-installer-plugin https://github.com/generalredneck/drupal-libraries-installer-plugin/issues/3

    Any clues?

    opened by lpalgarvio 3
  • Adding multiple repos to directory is failing.

    Adding multiple repos to directory is failing.

    Trying to add several repos to a specific directory. Seems to skipping the 1st repo. .json

    { "name": "drupal/recommended-project", "description": "Project template for Drupal 9 projects with a relocated document root", "type": "project", }, "repositories": [ { "type": "vcs", "url": "https://github.gatech.edu/ICWebTeam/block_alerts.git" }, { "type": "vcs", "url": "https://github.gatech.edu/ICWebTeam/block_badges.git" }, { "type": "vcs", "url": "https://github.gatech.edu/ICWebTeam/block_counter.git" } ], "require": { "gt/alerts": "dev-master", "gt/badges": "dev-master", "gt/counter": "dev-master", "mnsami/composer-custom-directory-installer": "^2.0", }, "conflict": { "drupal/drupal": "*" }, "minimum-stability": "dev", "prefer-stable": true, "config": { "sort-packages": true },

    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "installer-paths": {
                 "web/themes/contrib/darwin/templates/block/custom/{$name}": [
                "gt/alerts",
                "gt/badges",
                "gt/counter"
            ]
        },
        "drupal-core-project-message": {
            "include-keys": [
                "homepage",
                "support"
            ],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/8/install",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        }
    }
    

    }

    opened by bwaye3 1
  • installer-build-prod

    installer-build-prod

    Hey cool library,

    Unless im missing something, would you accept a PR to support an installer-build-prod option to overwrite the values in installer-build ?

    I think I would need to modify here ?

    https://github.com/mnsami/composer-custom-directory-installer/blob/1ccaf2da421dd9f6bcec4631c38e69e67677125f/src/Composer/CustomDirectoryInstaller/PackageUtils.php#L29

    opened by turtle0x1 4
This composer plugin removes unnecessary development files and directories from vendor directory

Composer Vendor Cleaner This composer plugin removes unnecessary development files and directories from vendor directory. Installation Local installat

Libor M. 15 Dec 16, 2022
Yii Aliases - store path aliases, i.e. short name representing a long path

Yii Aliases The package aim is to store path aliases, i.e. short name representing a long path (a file path, a URL, etc.). Path alias value may have a

Yii Software 20 Nov 8, 2022
This plugin help us to remove the unused file or directories in vendor

Composer Ignore Plugin This plugin help us to remove the unused file or directories in vendor. Installation Both global or local install can work well

__FresHmaN 21 Oct 21, 2021
Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins.

Imposter Plugin Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins. Built with ♥ by Typ

Typist Tech 127 Dec 17, 2022
Silverstripe-searchable - Adds to the default Silverstripe search by adding a custom results controller and allowing properly adding custom data objects and custom fields for searching

SilverStripe Searchable Module UPDATE - Full Text Search This module now uses Full Text Support for MySQL/MariaDB databases in version 3.* Adds more c

ilateral 13 Apr 14, 2022
Composer Repository Manager for selling Magento 2 extension and offering composer installation for ordered packages.

Magento 2 Composer Repository Credits We got inspired by https://github.com/Genmato. Composer Repository for Magento 2 This extension works as a Magen

EAdesign 18 Dec 16, 2021
Shortest Path - have a function ShortestPath (strArr) take strArr which will be an array of strings which models a non-looping Graph.

Have the function ShortestPath(strArr) take strArr which will be an array of strings which models a non-looping Graph

null 1 Feb 5, 2022
YCOM Impersonate. Login as selected YCOM user 🧙‍♂️in frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Friends Of REDAXO 17 Sep 12, 2022
A sampling profiler for PHP written in PHP, which reads information about running PHP VM from outside of the process.

Reli Reli is a sampling profiler (or a VM state inspector) written in PHP. It can read information about running PHP script from outside of the proces

null 272 Dec 22, 2022
A sampling profiler for PHP written in PHP, which reads information about running PHP VM from outside of the process.

Reli Reli is a sampling profiler (or a VM state inspector) written in PHP. It can read information about running PHP script from outside of the proces

null 258 Sep 15, 2022
A Bayesian average is a method of estimating the mean of a population using outside information, especially a pre-existing belief, which is factored into the calculation

A Bayesian average is a method of estimating the mean of a population using outside information, especially a pre-existing belief, which is factored into the calculation.

Assisted Mindfulness 3 Oct 19, 2022
This composer installer plugin allows for easy installation of PHP_CodeSniffer coding standards

PHP_CodeSniffer Standards Composer Installer Plugin This composer installer plugin allows for easy installation of PHP_CodeSniffer coding standards (r

PHPCSStandards 393 Feb 25, 2022
Sync Wordpress Pages and Posts (even custom post types + fields) from static Markdown + YAML files

Sync Markdown Files to WordPress Posts and Pages Static site generators let you use a revision-controlled tree of markdown files to make a site, but d

null 26 Sep 26, 2022
Wordpress/Elementor Plugin to list files from any folder

File List - Wordpress/Elementor Plugin Elementor plugin to generate a file list from an existing folder and rendering .index.html files as headers. Ge

Nabil Redmann 1 Jan 27, 2022
The Drupal Vendor Hardening Composer Plugin

The Drupal Vendor Hardening Composer Plugin

Drupal 13 Oct 4, 2022
An Alfred 4 workflow for quickly opening directories in Visual Studio Code

Alfred Workflow - Open in Visual Studio Code An Alfred 4 workflow opening files or folders with Visual Studio Code. Note: Alfred Powerpack is required

Daan Hage 2 Jun 27, 2022
Compares two directories and removes the duplicate files from the second directory.

How does the HRZ Duplicate Refiner work? 1- Compares two directories : patternDir: the directory used as the pattern & does not change. victimDir: A d

Hamidreza Zolfaghar 2 May 6, 2022