dg/composer-backslasher

Composer plugin that speeds up your application by adding backslashes to all PHP internal functions and constants.

This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.

Maintainers

Package info

github.com/dg/composer-backslasher

Type:composer-plugin

pkg:composer/dg/composer-backslasher

Statistics

Installs: 17 799

Dependents: 0

Suggesters: 0

Stars: 41

Open Issues: 0

v1.0.0 2019-09-30 01:28 UTC

This package is auto-updated.

Last update: 2025-12-29 02:58:29 UTC


README

Downloads this Month Build Status

Composer plugin that speeds up your application by adding backslashes to all PHP internal functions and constants in /vendor. Does not modify files of your application.

Installation

composer require dg/composer-backslasher

Then simply use composer update.

How it works?

It simply turns this code:

namespace A;

if (preg_match('/(foo)(bar)(baz)/', 'foobarbaz', $matches, PREG_OFFSET_CAPTURE)) {
	// ...
}

into this code:

namespace A;

if (\preg_match('/(foo)(bar)(baz)/', 'foobarbaz', $matches, \PREG_OFFSET_CAPTURE)) {
	// ...
}

to avoid double lookup for global functions and constants.

Configuration

If you want to ignore certain functions or constants, specify them in the configuration. Simply add a extra > backslasher-ignore section to composer.json file:

{
	"extra": {
		"backslasher-ignore": [
			"GuzzleHttp\\Promise\\each"
		]
	}
}

Support Project

Do you like Composer Backslasher? Are you looking forward to the new features?

Donate