PHPackages                             axhm3a/phpgcs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. axhm3a/phpgcs

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

axhm3a/phpgcs
=============

tool that seeks for usage of global constants in php scripts

v1.0.0(10y ago)07771MITPHP

Since Jun 18Pushed 10y ago1 watchersCompare

[ Source](https://github.com/axhm3a/phpgcs)[ Packagist](https://packagist.org/packages/axhm3a/phpgcs)[ RSS](/packages/axhm3a-phpgcs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/e64017539fd0fd01e372fe02bcae17959e20a196ff25d7c91a11e67aeece9ff2/68747470733a2f2f7472617669732d63692e6f72672f6178686d33612f7068706763732e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/axhm3a/phpgcs)[![Latest Stable Version](https://camo.githubusercontent.com/cc71501720c8ed93cc25d9be259b3bf83195db7d22407189607c6fb5af935e5f/68747470733a2f2f706f7365722e707567782e6f72672f6178686d33612f7068706763732f76657273696f6e)](https://packagist.org/packages/axhm3a/phpgcs)[![License](https://camo.githubusercontent.com/17053059b618334cdfccbe15793e6efeebf0dd66f8998c61d074ad9b51150ac4/68747470733a2f2f706f7365722e707567782e6f72672f6178686d33612f7068706763732f6c6963656e7365)](https://packagist.org/packages/axhm3a/phpgcs)

phpgcs
======

[](#phpgcs)

A command line tool that shows usages of global constants in php code.

In 2013 I worked on an legacy eCommerce application relying heavily on global constants for runtime configuration. I made this tool to find and substitute all constant usages in order to sustain testability.

Usage
-----

[](#usage)

A listing of available options:

```
Usage: phpgcs [switches] [PATH]

--ignore-builtin
        ignores pre defined constants like PHP_EOL, LOCK_EX...

--ignore-const
        list of constants to be ignored
        --ignore-const=CONST1,CONST2,...
--exclude-path
        list of path patterns to be excluded
        --exclude-paths=.phtml,tests/,...

```

A sample
--------

[](#a-sample)

it lists all files in path passed by argument with usage of global constants by name and line number

```
./phpgcs tests/
tests/Axhm3a/Phpgcs/Fixture.php
        10:     BOOL_RUNNING_LOCAL
        12:     METHOD
        17:     PHP_EOF

3 Usage(s) in 1 File(s).

```

Content of Fixture.php:

```
