https://github.com/dgame/php-conditional
https://github.com/dgame/php-conditional
conditional debug php version
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dgame/php-conditional
- Owner: Dgame
- Created: 2016-06-09T00:05:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-09T18:36:39.000Z (almost 9 years ago)
- Last Synced: 2025-05-10T01:18:10.996Z (9 months ago)
- Topics: conditional, debug, php, version
- Language: PHP
- Size: 46.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# php-conditional
[](https://scrutinizer-ci.com/g/Dgame/php-conditional/?branch=master)
[](https://travis-ci.org/Dgame/php-conditional)
## enjoy conditional php-programming
```php
enable();
debug('foo')->output('Hello, foo');
debug('foo')->then(function(string $label) {
print 'Debug of ' . $label . ' is enabled' . PHP_EOL;
});
version('7.0.8')->isEqualTo(PHP_VERSION)->output('Hello PHP 7');
version('7')->isLowerOrEqualTo(PHP_VERSION)->then(function(string $version) {
print 'Version ' . $version . ' is verified' . PHP_EOL;
});
version('7.0.9')->isEqualTo(PHP_VERSION)->output('Production')->otherwise(function(string $version) {
print $version . ' does not match ' . PHP_VERSION . PHP_EOL;
});
//debug('foo')->output('This is 100% the end')->abort();
//debug('foo')->output('This may be the end')->abortIf(!isset($result));
version('7.1.0alpha2')->isProduction()->output('Production');
class FooBar
{
public function test(string $label, string $note)
{
print __METHOD__ . ' [' . $label . '] : ' . $note . PHP_EOL;
}
}
$fb = new FooBar();
debug('bar')->enable();
debug('bar')->then([$fb, 'test'], 'yay');
```