2017 © Pedro Peláez
 

composer-plugin composer-symlinks

Create relative symlinks based on getcwd() and relative data

image

somework/composer-symlinks

Create relative symlinks based on getcwd() and relative data

  • Wednesday, February 21, 2018
  • by somework
  • Repository
  • 3 Watchers
  • 3 Stars
  • 1,021 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 11 Versions
  • 49 % Grown

The README.md

ComposerSymlinks

Its provide a simple Composer script to symlink paths. Compatible with Composer v2., (*1)

Installation

To install the latest stable version of this component, open a console and execute the following command:, (*2)

$ composer require somework/composer-symlinks

Usage

Create the symlinks definition adding a somework/composer-symlinks section inside the extra section of the composer.json file., (*3)

The behaviour of the plugin can be tuned via the following configuration keys:, (*4)

Key Default Description
skip-missing-target false Do not fail when the target does not exist.
absolute-path false Create symlinks using the real path to the target.
throw-exception true Throw an exception on errors instead of just printing the message.
force-create false Remove any existing file or directory at the link path before creating the symlink.

You can set personal configs for any symlink.
For personal configs link must be defined, (*5)

{
    "extra": {
        "somework/composer-symlinks": {
            "symlinks": {
                "common/upload": "web/upload",
                "common/static/dest": {
                    "link": "web/dest",
                    "skip-missing-target": false,
                    "absolute-path": true,
                    "throw-exception": false
                }
            },
            "force-create": false,
            "skip-missing-target": false,
            "absolute-path": false,
            "throw-exception": true
        }
    }
}

3. Execute composer

DO NOT use --no-plugins for composer install or update, (*6)

Dry run

Set environment variable SYMLINKS_DRY_RUN=1 to preview created links without modifying the filesystem., (*7)

Example output:, (*8)

$ SYMLINKS_DRY_RUN=1 composer install --no-interaction
  [DRY RUN] Symlinking /tmp/sample/linked.txt to /tmp/sample/source/file.txt

Typical error messages

Message Meaning
No link passed in config The link option was missing for a symlink definition.
No target passed in config The key of the symlinks map was empty.
Invalid symlink target path The target path was absolute but should be relative.
Invalid symlink link path The link path was absolute but should be relative.
The target path ... does not exists The target file or directory was not found.
Link ... already exists A file/directory already occupies the link path.
Cant unlink ... The plugin failed to remove a file when using force-create.

Windows compatibility

On Windows, creating symlinks requires either Administrator privileges or that the system is running in Developer Mode. The plugin itself works, but the underlying operating system may refuse to create a link if permissions are insufficient. Additionally, relative symlinks use Unix-style / separators internally which Windows resolves correctly., (*9)

License

This component is under the MIT license. See the complete license in the LICENSE file., (*10)

Reporting an issue or a feature request

Issues and feature requests are tracked in the Github issue tracker., (*11)

The Versions

21/02 2018

dev-master

9999999-dev

Create relative symlinks based on getcwd() and relative data

  Sources   Download

MIT

The Requires

  • php >7.0
  • composer-plugin-api ^1.0

 

The Development Requires

by Pinchuk Igor

21/02 2018

1.3.1

1.3.1.0

Create relative symlinks based on getcwd() and relative data

  Sources   Download

MIT

The Requires

  • php >7.0
  • composer-plugin-api ^1.0

 

The Development Requires

by Pinchuk Igor

21/02 2018

1.3.0

1.3.0.0

Create relative symlinks based on getcwd() and relative data

  Sources   Download

MIT

The Requires

  • php >7.0
  • composer-plugin-api ^1.0

 

The Development Requires

by Pinchuk Igor

21/02 2018

1.2.0

1.2.0.0

Create relative symlinks based on getcwd() and relative data

  Sources   Download

MIT

The Requires

  • php >7.0
  • composer-plugin-api ^1.0

 

The Development Requires

by Pinchuk Igor

20/02 2018

1.1.1

1.1.1.0

Create relative symlinks based on getcwd() and relative data

  Sources   Download

MIT

The Requires

  • php >7.0
  • composer-plugin-api ^1.0

 

The Development Requires

by Pinchuk Igor

20/02 2018

1.1

1.1.0.0

Create relative symlinks based on getcwd() and relative data

  Sources   Download

MIT

The Requires

  • php >7.0
  • composer-plugin-api ^1.0

 

The Development Requires

by Pinchuk Igor

20/02 2018

1.0

1.0.0.0

Create relative symlinks based on getcwd() and relative data

  Sources   Download

MIT

The Requires

  • php >7.0
  • composer-plugin-api ^1.0

 

The Development Requires

by Pinchuk Igor

16/11 2017

0.3.1

0.3.1.0

Create relative symlinks based on getcwd() and relative data

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pinchuk Igor

01/11 2017

0.3

0.3.0.0

Create relative symlinks based on getcwd() and relative data

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pinchuk Igor

30/10 2017

0.2

0.2.0.0

Create relative symlinks based on getcwd() and relative data

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pinchuk Igor

30/10 2017

0.1

0.1.0.0

Create relative symlinks based on getcwd() and relative data

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pinchuk Igor