{"id":15638967,"url":"https://github.com/nilportugues/php-backslasher","last_synced_at":"2025-08-09T21:15:54.387Z","repository":{"id":57027209,"uuid":"45342909","full_name":"nilportugues/php-backslasher","owner":"nilportugues","description":"[Git hook] Tool to add all PHP internal functions and constants to its namespace by adding backslash to them.","archived":false,"fork":false,"pushed_at":"2020-04-21T20:40:00.000Z","size":2105,"stargazers_count":88,"open_issues_count":0,"forks_count":5,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-21T12:39:39.066Z","etag":null,"topics":["backslash","ci","git","git-hook","git-hooks","namespace","php","php-backslasher","php-internals","php7"],"latest_commit_sha":null,"homepage":"http://nilportugues.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nilportugues.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-01T14:10:51.000Z","updated_at":"2024-11-09T21:30:41.000Z","dependencies_parsed_at":"2022-08-23T16:30:10.554Z","dependency_job_id":null,"html_url":"https://github.com/nilportugues/php-backslasher","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/nilportugues/php-backslasher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilportugues%2Fphp-backslasher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilportugues%2Fphp-backslasher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilportugues%2Fphp-backslasher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilportugues%2Fphp-backslasher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilportugues","download_url":"https://codeload.github.com/nilportugues/php-backslasher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilportugues%2Fphp-backslasher/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259804839,"owners_count":22913901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backslash","ci","git","git-hook","git-hooks","namespace","php","php-backslasher","php-internals","php7"],"created_at":"2024-10-03T11:24:13.395Z","updated_at":"2025-06-14T11:04:50.323Z","avatar_url":"https://github.com/nilportugues.png","language":"PHP","readme":"[![Build Status](https://travis-ci.org/nilportugues/php-backslasher.svg)](https://travis-ci.org/nilportugues/php-backslasher)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nilportugues/php_backslasher/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nilportugues/php_backslasher/?branch=master) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/809a5ba0-e7a0-4d05-8533-e94fa0bd8b9a/mini.png)](https://insight.sensiolabs.com/projects/809a5ba0-e7a0-4d05-8533-e94fa0bd8b9a) [![Latest Stable Version](https://poser.pugx.org/nilportugues/php_backslasher/v/stable)](https://packagist.org/packages/nilportugues/php_backslasher) [![Total Downloads](https://poser.pugx.org/nilportugues/php_backslasher/downloads)](https://packagist.org/packages/nilportugues/php_backslasher) [![License](https://poser.pugx.org/nilportugues/php_backslasher/license)](https://packagist.org/packages/nilportugues/php_backslasher)\n[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://paypal.me/nilportugues)\n\n# PHP BackSlasher\n\nTool to add all PHP **internal functions and constants** to its namespace by adding backslash to them.\n\nFunction resolution without the backslash forces the PHP internals to verify for each function call if function or constant belongs to current namespace or the global namespace. With the backslash  PHP does not check the current namespace and therefore execution is faster when using OP Cache.\n\n**Idea from Nikita Popov talk**: \n- [PHP 7 – What changed internally? (PHP Barcelona 2015)](http://www.slideshare.net/nikita_ppv/php-7-what-changed-internally-php-barcelona-2015) (slide [72](http://image.slidesharecdn.com/php7internals-151101105627-lva1-app6891/95/php-7-what-changed-internally-php-barcelona-2015-72-638.jpg?cb=1446375542))\n\n## Installation\n\nUse [Composer](https://getcomposer.org) to install the package:\n\n```\n$ composer require --dev nilportugues/php_backslasher\n```\n\n## Usage\n\n```\n$ php bin/php_backslasher fix \u003cpath/to/directory\u003e\n```\n\n### Output\n\nWorks for functions in conditional statements, negative conditionals, placed in an array as key or value and any other normal use. Also adds a backslash to defined constants and true, false and null values.\n\n#### Internal functions and constants\n```php\necho strlen('Hello World');\nvar_dump(null);\nvar_dump(false);\necho DIRECTORY_SEPARATOR;\nreturn true;\n\n// becomes:\necho \\strlen('Hello World');\n\\var_dump(\\null);\n\\var_dump(\\false);\necho \\DIRECTORY_SEPARATOR;\nreturn \\true;\n```\n\n\n## Contribute\n\nContributions to the package are always welcome!\n\n* Report any bugs or issues you find on the [issue tracker](https://github.com/nilportugues/php_backslasher/issues/new).\n* You can grab the source code at the package's [Git repository](https://github.com/nilportugues/php_backslasher).\n\n\n\n## Support\n\nGet in touch with me using one of the following means:\n\n - Emailing me at \u003ccontact@nilportugues.com\u003e\n - Opening an [Issue](https://github.com/nilportugues/php_backslasher/issues/new)\n\n\n\n## Authors\n\n* [Nil Portugués Calderó](http://nilportugues.com)\n* [The Community Contributors](https://github.com/nilportugues/php_backslasher/graphs/contributors)\n\n\n## License\nThe code base is licensed under the [MIT license](LICENSE).\n","funding_links":["https://paypal.me/nilportugues"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilportugues%2Fphp-backslasher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilportugues%2Fphp-backslasher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilportugues%2Fphp-backslasher/lists"}