-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Fery Wardiyanto <ferywardiyanto@gmail.com>
- Loading branch information
0 parents
commit edba95a
Showing
13 changed files
with
465 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
src_dir: . | ||
service_name: travis-ci | ||
coverage_clover: clover.xml | ||
json_path: coveralls-upload.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
indent_style = space | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = false | ||
indent_style = space | ||
|
||
[{src,tests}/**.php] | ||
indent_size = 4 | ||
|
||
[*.{json,yml}] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Enforce Unix newlines | ||
* text=lf | ||
|
||
# Exclude unused files | ||
# see: https://redd.it/2jzp6k | ||
/tests export-ignore | ||
/.coveralls.yml export-ignore | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.travis.yml export-ignore | ||
/phpunit.xml.dist export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.directory | ||
composer.lock | ||
vendor | ||
clover.xml | ||
coveralls-upload.json | ||
*.sublime-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
language: php | ||
|
||
php: | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- hhvm | ||
|
||
install: | ||
- if [[ "$TRAVIS_PHP_VERSION" == '5.6' ]]; then composer require satooshi/php-coveralls:dev-master -n ; fi | ||
- composer install -n | ||
|
||
script: | ||
- if [[ "$TRAVIS_PHP_VERSION" == '5.6' ]]; then phpunit --coverage-clover clover.xml ; fi | ||
- phpunit --coverage-clover clover.xml | ||
|
||
after_script: | ||
- if [[ "$TRAVIS_PHP_VERSION" == '5.6' ]]; then php vendor/bin/coveralls -v ; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# How to Contribute | ||
|
||
## Pull Requests | ||
|
||
1. Fork this repository | ||
2. Create a new branch for each feature or improvement | ||
3. Send a pull request from each feature branch | ||
|
||
It is very important to separate new features or improvements into separate feature branches, and to send a pull request for each branch. This allows me to review and pull in new features or improvements individually. | ||
|
||
## Style Guide | ||
|
||
All pull requests must adhere to the [PSR-2 standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). | ||
|
||
## Unit Testing | ||
|
||
All pull requests must be accompanied by passing unit tests and complete code coverage. | ||
|
||
[Learn about PHPUnit](https://github.com/sebastianbergmann/phpunit/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Fery Wardiyanto <hallo@feryardiant.me> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# [Unofficial] Slim Framework 3.x Monolog Logger | ||
|
||
[![Build Status](https://img.shields.io/travis/projek-xyz/slim-monolog/master.svg?style=flat-square)](https://travis-ci.org/projek-xyz/slim-monolog) [![LICENSE](https://img.shields.io/packagist/l/projek-xyz/slim-monolog.svg?style=flat-square)](https://packagist.org/packages/projek-xyz/slim-monolog) [![VERSION](https://img.shields.io/packagist/v/projek-xyz/slim-monolog.svg?style=flat-square)](https://packagist.org/packages/projek-xyz/slim-monolog) [![Coveralls branch](https://img.shields.io/coveralls/projek-xyz/slim-monolog/master.svg?style=flat-square)](https://coveralls.io/github/projek-xyz/slim-monolog) | ||
|
||
This is a Slim Framework 3.x component helper built on top of the Monolog Logger. | ||
|
||
## Install | ||
|
||
Via [Composer](https://getcomposer.org/) | ||
|
||
```bash | ||
$ composer require projek-xyz/slim-monolog --prefer-dist | ||
``` | ||
|
||
Requires Slim Framework 3 and PHP 5.5.0 or newer. | ||
|
||
## Usage | ||
|
||
```php | ||
// Create Slim app | ||
$app = new \Slim\App(); | ||
|
||
// Fetch DI Container | ||
$container = $app->getContainer(); | ||
|
||
// Register Monolog helper: | ||
// Option 1, using MonologProvider | ||
$container->register(new \Projek\Slim\MonologProvider); | ||
|
||
// Option 2, using Closure | ||
$container['view'] = function ($c) { | ||
$view = new \Projek\Slim\Monolog([ | ||
'directory' => 'path/to/logs', | ||
]); | ||
|
||
return $view; | ||
}; | ||
|
||
// Define named route | ||
$app->get('/hello/{name}', function ($req, $res, $args) { | ||
return $this->view->render($res, 'profile', [ | ||
'name' => $args['name'] | ||
]); | ||
})->setName('profile'); | ||
|
||
// Run app | ||
$app->run(); | ||
``` | ||
|
||
**NOTE**: if you are using _option 1_ please make sure you already have `$container['settings']['monolog']` in your configuration file. | ||
|
||
## Custom template functions | ||
|
||
... | ||
|
||
```php | ||
// | ||
``` | ||
|
||
## Testing | ||
|
||
```bash | ||
phpunit | ||
``` | ||
|
||
## Contributing | ||
|
||
Please see [CONTRIBUTING](CONTRIBUTING.md) for details. | ||
|
||
## Credits | ||
|
||
- [Fery Wardiyanto](http://feryardiant.me) | ||
- [Slim Framework](http://www.slimframework.com) | ||
- [Monolog](https://github.com/Seldaek/monolog) | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "projek-xyz/slim-monolog", | ||
"description": "Slim Framework 3 view helper built on top of the Plates templating component", | ||
"keywords": ["slim","framework","view","template","monolog"], | ||
"homepage": "http://www.projek.xyz/slim-monolog", | ||
"type": "library", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Fery Wardiyanto", | ||
"email": "hallo@feryardiant.me", | ||
"homepage": "http://feryardiant.me" | ||
} | ||
], | ||
"support": { | ||
"issues": "https://github.com/projek-xyz/slim-monolog/issues", | ||
"source": "https://github.com/projek-xyz/slim-monolog" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Projek\\Slim\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Projek\\Slim\\Tests\\": "tests/" | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"require": { | ||
"php": ">=5.5.0", | ||
"slim/slim": "3.x-dev", | ||
"monolog/monolog": "^1.17" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~4.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit | ||
bootstrap="vendor/autoload.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
colors="true"> | ||
|
||
<testsuites> | ||
<testsuite name="Slim Monolog Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory>./src</directory> | ||
</whitelist> | ||
</filter> | ||
|
||
</phpunit> |
Oops, something went wrong.