An open API service indexing awesome lists of open source software.

https://github.com/ghostwriter/handrail

Safeguard PHP functions from redeclaration conflicts
https://github.com/ghostwriter/handrail

composer composer-plugin conflicts functions ghostwriter handrail php plugin redeclaration safeguard

Last synced: 8 months ago
JSON representation

Safeguard PHP functions from redeclaration conflicts

Awesome Lists containing this project

README

          

# Handrail

[![GitHub Sponsors](https://img.shields.io/github/sponsors/ghostwriter?label=Sponsor+@ghostwriter/handrail&logo=GitHub+Sponsors)](https://github.com/sponsors/ghostwriter)
[![Automation](https://github.com/ghostwriter/handrail/actions/workflows/automation.yml/badge.svg)](https://github.com/ghostwriter/handrail/actions/workflows/automation.yml)
[![Supported PHP Version](https://badgen.net/packagist/php/ghostwriter/handrail?color=8892bf)](https://www.php.net/supported-versions)
[![Downloads](https://badgen.net/packagist/dt/ghostwriter/handrail?color=blue)](https://packagist.org/packages/ghostwriter/handrail)

Safeguard your PHP code by wrapping function declarations in `if (!function_exists())` blocks.

Ensures that functions are only declared if they do not already exist, preventing redeclaration conflicts.

### Star ⭐️ this repo if you find it useful

You can also star (🌟) this repo to find it easier later.

## Installation

You can install the package via composer:

``` bash
composer require ghostwriter/handrail
```

### Example

Before running Handrail:

```php
guard($phpFile);
```

### Credits

- [Nathanael Esayeas](https://github.com/ghostwriter)
- [All Contributors](https://github.com/ghostwriter/handrail/contributors)

### Thanks

- [Yevhen Sidelnyk](https://github.com/rela589n) for the [inspiration](https://github.com/rela589n/knowledge-base/blob/a72b3071b770253dc61d03d8d2849e47a8229bc7/PHP/Psalm%20in%20a%20separate%20composer.json.md).

### Changelog

Please see [CHANGELOG.md](./CHANGELOG.md) for more information on what has changed recently.

### License

Please see [LICENSE](./LICENSE) for more information on the license that applies to this project.

### Security

Please see [SECURITY.md](./SECURITY.md) for more information on security disclosure process.