All Projects → vaimo → Composer Patches

vaimo / Composer Patches

Licence: mit
Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and composer command for testing/troubleshooting patches.

Projects that are alternatives of or similar to Composer Patches

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.
Stars: ✭ 117 (-40.31%)
Mutual labels:  composer, composer-plugin, composer-packages
Awesome Composer
😎 A curated awesome list for Composer, Packagist, Satis, Plugins, Scripts, Composer related resources, tutorials.
Stars: ✭ 738 (+276.53%)
Mutual labels:  composer, composer-plugin, composer-packages
Beetbox
Pre-provisioned L*MP stack
Stars: ✭ 94 (-52.04%)
Mutual labels:  composer, composer-plugin
Composer Cleaner
Victor The Cleaner: removes unnecessary files from vendor directory
Stars: ✭ 114 (-41.84%)
Mutual labels:  composer, composer-plugin
Satis Control Panel
Satis Control Panel (SCP) is a simple web UI for managing your Satis Repository for Composer Packages.
Stars: ✭ 144 (-26.53%)
Mutual labels:  composer, composer-packages
Composer Notifier
💬 Display desktop notification after Composer install / update
Stars: ✭ 42 (-78.57%)
Mutual labels:  composer, composer-plugin
Studio
A workbench for developing Composer packages.
Stars: ✭ 1,021 (+420.92%)
Mutual labels:  composer-plugin, composer-packages
Foxy
A fast, reliable, and secure NPM/Yarn bridge for Composer
Stars: ✭ 137 (-30.1%)
Mutual labels:  composer, composer-plugin
Composer Normalize
🎵 Provides a composer plugin for normalizing composer.json.
Stars: ✭ 602 (+207.14%)
Mutual labels:  composer, composer-plugin
Packages
Enhances Composer Satis with webhook integrations to GitHub and GitLab
Stars: ✭ 157 (-19.9%)
Mutual labels:  composer, composer-packages
Composer Lock Diff
See what has changed after a composer update
Stars: ✭ 154 (-21.43%)
Mutual labels:  plugin, composer
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+1028.57%)
Mutual labels:  composer, composer-packages
Composer Dropin Installer
Use composer for installing dropin dependencies
Stars: ✭ 30 (-84.69%)
Mutual labels:  composer, composer-plugin
Skrub
A package to remove junk from Composer installations and trim build sizes.
Stars: ✭ 91 (-53.57%)
Mutual labels:  composer, composer-plugin
Composer Merge Plugin
Merge one or more additional composer.json files at Composer runtime
Stars: ✭ 718 (+266.33%)
Mutual labels:  composer, composer-plugin
Laravel Messenger
Simple user messaging package for Laravel
Stars: ✭ 2,140 (+991.84%)
Mutual labels:  composer, composer-packages
Composer Registry Manager
🛠 🔨 Composer registry manager that help to easily switch to the composer repository you want.
Stars: ✭ 448 (+128.57%)
Mutual labels:  composer, composer-plugin
Composer Changelogs
📓 Display better summary after Composer update
Stars: ✭ 540 (+175.51%)
Mutual labels:  composer, composer-plugin
Srl Php
Simple Regex Language
Stars: ✭ 1,808 (+822.45%)
Mutual labels:  composer, composer-packages
Private Composer Installer
Composer install helper outsourcing sensitive keys from the package URL into environment variables
Stars: ✭ 168 (-14.29%)
Mutual labels:  composer, composer-plugin

Vaimo Composer Patches

Latest Stable Version Build Status Total Downloads Daily Downloads Minimum PHP Version Scrutinizer Code Quality Code Climate

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level in package config or separate JSON file. Declaration-free mode (using embedded info within patch files) is available as well.

The way the patches are applied (the commands, pre-checks) by the plugin is fully configurable (including the actual commands that are executed to apply the patch) from the composer.json of the project.

Note that the plugin is kept on very old PHP version as legacy software is usually the most common context where patches are needed.

Full Documentation

  • Basic Usage - Defining patches via configuration files or embedded metadata
  • Advanced Usage - Advanced usage options when defining patches
  • Configuration - Configuration options for the patch applier
  • Commands - Details on the CLI commands that ship with the plugin
  • Environment Variables - Environment variables to change plugin behavior
  • Error Handling - Handling encountered errors
  • Development - Details on the development workflow of the plugin
  • Examples - Examples on usage of the plugin
  • Changes - List of changes/fixes per plugin release

Quick Start

Composer packages can be targeted with patches in two ways:

  • Embedded metadata (recommended default approach)
  • JSON declaration and embedded (recommended for remote patches)

Usage: Embedded Metadata

{
  "require": {
    "some/package-name": "1.2.3"
  },
  "extra": {
    "patcher": {
      "search": "patches"
    }
  }
}

Contents of patches/changes.patch:

This patch changes... 
absolutely everything

@package some/package-name

--- Models/Example.php.org
+++ Models/Example.php
@@ -31,7 +31,7 @@
      */
     protected function someFunction($someArg)
     {
-        $var1 = 123;
+        $var1 = 456;
         /**
          * rest of the logic of the function
          */

Full list of tag options (that cover all features of the plugin can be found HERE).

Note that tags cover most of the features of the module so every explanation given for the json declaration of the patches applies for tags as well.

Usage: JSON Declaration

{
  "require": {
    "some/package-name": "1.2.3"
  },
  "extra": {
    "patches": {
      "some/package-name": {
        "This patch changes ... absolutely everything": "patches/changes.patch",
        "remote patch": "http://www.example.com/remote-patch.patch",
        "remote patch with checksum check": {
          "source": "http://www.example.com/other-patch.patch",
          "sha1": "5a52eeee822c068ea19f0f56c7518d8a05aef16e"
        }
      }
    }
  }
}

Contents of patches/changes.patch:

--- Models/Example.php.org
+++ Models/Example.php
@@ -31,7 +31,7 @@
      */
     protected function someFunction($someArg)
     {
-        $var1 = 123;
+        $var1 = 456;
         /**
          * rest of the logic of the function
          */

Applier Configuration

The way patches are applied can be manipulated by changing the configuration of the patcher or by introducing additional patch appliers.

In most cases there should not be much of a need to reconfigure the module as it does ship with reasonable defaults. The appliers supported by default: patch, git.

More information on said topic can be found HERE.

Upgrades

When upgrading the module, one might encounter odd crashes about classes not being found or class constructor arguments being wrong.

This usually means that the class structure or constructor footprint in some of the classes have changed after the upgrade which means that the plugin might be running with some classes from the old and some classes from the new version.

Due to the fact that the patcher kicks in very late in the process of installing a project (before auto-loader generation), developers are advised to re-execute composer install.

Ideally, plugins should always be updated with explicit --no-plugins flag added to the composer update call to avoid issues that plugin usage with potentially mixed logic from two different plugin releases being in use.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].