Skip to content

Commit

Permalink
Add 5.5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mlanin committed Oct 13, 2017
1 parent b9d9ca1 commit 93c8697
Show file tree
Hide file tree
Showing 16 changed files with 375 additions and 400 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_style = space
indent_size = 2
104 changes: 25 additions & 79 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,82 +1,28 @@
<?php

use Symfony\CS\Config\Config;
use Symfony\CS\FixerInterface;
use Symfony\CS\Finder\DefaultFinder;

$fixers = [
'blankline_after_open_tag',
'braces',
'concat_with_spaces',
'double_arrow_multiline_whitespaces',
'duplicate_semicolon',
'elseif',
'empty_return',
'encoding',
'eof_ending',
'extra_empty_lines',
'function_call_space',
'function_declaration',
'include',
'indentation',
'join_function',
'line_after_namespace',
'linefeed',
'list_commas',
'logical_not_operators_with_successor_space',
'lowercase_constants',
'lowercase_keywords',
'method_argument_space',
'multiline_array_trailing_comma',
'multiline_spaces_before_semicolon',
'multiple_use',
'namespace_no_leading_whitespace',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'object_operator',
'operators_spaces',
'ordered_use',
'parenthesis',
'phpdoc_indent',
'phpdoc_inline_tag',
'phpdoc_no_access',
'phpdoc_no_package',
'phpdoc_scalar',
'phpdoc_short_description',
'phpdoc_to_comment',
'phpdoc_trim',
'phpdoc_type_to_var',
'phpdoc_var_without_name',
'remove_leading_slash_use',
'remove_lines_between_uses',
'return',
'self_accessor',
'short_array_syntax',
'short_echo_tag',
'short_tag',
'single_array_no_trailing_comma',
'single_blank_line_before_namespace',
'single_line_after_imports',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'trailing_spaces',
'trim_array_spaces',
'unary_operators_spaces',
'unused_use',
'visibility',
'whitespacy_lines',
/**
* Config for PHP-CS-Fixer ver2
*/
$rules = [
'@PSR2' => true,
// addtional rules
'array_syntax' => ['syntax' => 'short'],
'no_multiline_whitespace_before_semicolons' => true,
'no_short_echo_tag' => true,
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
];
$excludes = [
// add exclude project directory
'vendor',
];

$finder = Symfony\CS\Finder\DefaultFinder::create()
->exclude('vendor')
->exclude('storage')
->in(__DIR__);

return Config::create()
->finder($finder)
->fixers($fixers)
->level(FixerInterface::NONE_LEVEL)
->setUsingCache(true);
return PhpCsFixer\Config::create()
->setRules($rules)
->setFinder(
PhpCsFixer\Finder::create()
->exclude($excludes)
->in(__DIR__)
->notName('README.md')
->notName('*.xml')
->notName('*.yml')
);
17 changes: 12 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@ dist: trusty
language: php

php:
- 5.5
- 5.6
- 7.0
- hhvm
- 7.1

sudo: false

cache:
directories:
- $HOME/.composer/cache

install:
- travis_retry composer install --no-interaction --prefer-dist

before_script:
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist

script:
- if [ "$TRAVIS_PHP_VERSION" != "5.6" ]; then vendor/bin/phpunit; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi
- vendor/bin/phpcs --standard=psr2 src/
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' && $TRAVIS_PHP_VERSION != '7.0' ]]; then php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover; fi
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ When you are developing JSON API sometimes you need to debug it, but if you will

To get the latest version of Laravel Laravel-API-Debugger, simply add the following line to the require block of your `composer.json` file.

For Laravel 5.4
```
"lanin/laravel-api-debugger": "^0.3"
"lanin/laravel-api-debugger": "^3.0"
```

You'll then need to run `composer install` or `composer update` to download it and have the autoloader updated.
Expand All @@ -85,7 +84,7 @@ Before extension will populate your answer it will try to distinguish if it is a

Also please be careful with what you return. As if your answer will not be wrapped in any kind of `data` attribute (`pages` in the example above), frontend could be damaged because of waiting the particular set of attributes but it will return extra `debug` one.

So the best way to return your responses is like this
So the best way to return your responses is like this
```php
$data = [
'foo' => 'bar',
Expand All @@ -104,7 +103,7 @@ For more info about better practices in JSON APIs you can find here http://jsona

## Debugging

Debugger's two main tasks are to dump variables and collect anny additional info about your request.
Debugger's two main tasks are to dump variables and collect anny additional info about your request.

### Var dump

Expand All @@ -123,12 +122,12 @@ lad($foo, $bar);

You can simultaneously dump as many vars as you want and they will appear in the answer.

**Note!** Of course it it not the best way do debug your production environment, but sometimes it is the only way.
**Note!** Of course it it not the best way do debug your production environment, but sometimes it is the only way.
So be careful with this, because everyone will see your output, but at least debug will not break your clients.

### Collecting data

**Note!** By default Debugger will collect data ONLY when you set `APP_DEBUG=true`.
**Note!** By default Debugger will collect data ONLY when you set `APP_DEBUG=true`.
So you don't have to worry that someone will see your system data on production.

All available collections can be found in `api-debugger.php` config that you can publish and update as you wish.
Expand Down Expand Up @@ -171,7 +170,7 @@ lad_pr_me();

### Extending

You can easily add your own data collections to debug output.
You can easily add your own data collections to debug output.
Just look at how it was done in the package itself and repeat for anything you want (for example HTTP requests).

## Contributing
Expand Down
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
],
"require": {
"php": ">=5.6.0",
"illuminate/support": "~5.4"
"illuminate/support": "^5.4,<5.6"
},
"require-dev": {
"phpunit/phpunit": "~5.7",
"orchestra/testbench": "~3.4",
"phpunit/phpunit": "~6.0",
"orchestra/testbench": "~3.5",
"mockery/mockery": "0.9.*"
},
"autoload": {
Expand All @@ -33,5 +33,12 @@
}
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"extra": {
"laravel": {
"providers": [
"Lanin\\Laravel\\ApiDebugger\\ServiceProvider"
]
}
}
}
24 changes: 12 additions & 12 deletions config/api-debugger.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php

return [
/**
* Specify what data to collect.
*/
'collections' => [
// Database queries.
\Lanin\Laravel\ApiDebugger\Collections\QueriesCollection::class,
/**
* Specify what data to collect.
*/
'collections' => [
// Database queries.
\Lanin\Laravel\ApiDebugger\Collections\QueriesCollection::class,

// Show cache events.
\Lanin\Laravel\ApiDebugger\Collections\CacheCollection::class,
// Show cache events.
\Lanin\Laravel\ApiDebugger\Collections\CacheCollection::class,

// Profile custom events.
\Lanin\Laravel\ApiDebugger\Collections\ProfilingCollection::class,
],
];
// Profile custom events.
\Lanin\Laravel\ApiDebugger\Collections\ProfilingCollection::class,
],
];
Loading

0 comments on commit 93c8697

Please sign in to comment.