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
- Host: GitHub
- URL: https://github.com/ghostwriter/handrail
- Owner: ghostwriter
- License: other
- Created: 2024-10-06T22:13:33.000Z (over 1 year ago)
- Default Branch: 0.1.x
- Last Pushed: 2025-09-27T14:31:23.000Z (9 months ago)
- Last Synced: 2025-09-27T16:21:51.561Z (9 months ago)
- Topics: composer, composer-plugin, conflicts, functions, ghostwriter, handrail, php, plugin, redeclaration, safeguard
- Language: PHP
- Homepage: https://github.com/ghostwriter/handrail
- Size: 755 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Handrail
[](https://github.com/sponsors/ghostwriter)
[](https://github.com/ghostwriter/handrail/actions/workflows/automation.yml)
[](https://www.php.net/supported-versions)
[](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.