Skip to content

Commit

Permalink
PHP7 + Monolog 2 (#78)
Browse files Browse the repository at this point in the history
* Dependencies updated + composer.lock removed + GH Actions skeleton

* Removed .travis.yml

* Fix

* PHP 7

* Fix

* mbstring extension

* Test failed test

* Fix

* Added coveralls

* Fix

* Run only on push

* Up

* Up

* Optimize composer autoload

* Cosmetic

* Readme update

* Cosmetic

* Order changed

* issue template removed
  • Loading branch information
maxbanton committed Jan 6, 2020
1 parent 34de41e commit 7ea138d
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 2,616 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: PHP Composer
name: Pipeline

on: [push]
on: [push, pull_request]

jobs:
run:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
php-versions: ['7.2', '7.3', '7.4']
name: PHP ${{ matrix.php-versions }}
steps:
- name: Checkout
Expand All @@ -17,24 +17,36 @@ jobs:
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php-versions }}
tools: composer, phpunit, phpcbf, phpcs
extensions: mbstring
coverage: pcov

- name: Validate composer.json
run: composer validate

- name: Get Composer Cache Directory
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
run: composer install --prefer-dist --no-progress --no-suggest -o

- name: Check syntax
run: |
php -l src/
vendor/bin/phpcs --standard=psr2 --ignore=Tests src/
- name: Run tests
run: phpunit
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml

- name: Send to coveralls
run: php vendor/bin/php-coveralls -v
env:
COVERALLS_RUN_LOCALLY: 1
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
/.idea/
/vendor/
/composer.phar
/nbproject/
/puphpet/
/Vagrantfile
/.vagrant/
/html/
/coverage/
/example/
/.phpunit.result.cache
/composer.lock
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

24 changes: 0 additions & 24 deletions ISSUE_TEMPLATE.md

This file was deleted.

46 changes: 6 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,23 @@ Handler for PHP logging library [Monolog](https://github.com/Seldaek/monolog) fo

Before using this library, it's recommended to get acquainted with the [pricing](https://aws.amazon.com/en/cloudwatch/pricing/) for AWS CloudWatch services.

Please press **★ Star** button if you find this library useful, aslo you can [donate](#donate) if you like to.
Please press **★ Star** button if you find this library useful.

## Requirements
* PHP ^7.2
* AWS account with proper permissions (see [list of permissions below](#AWS IAM needed permissions))

## Features
* Up to 10000 batch logs sending in order to avoid _Rate exceeded_ errors
* Log Groups creating with tags
* AWS CloudWatch Logs staff lazy loading
* Suitable for web applications and for long-living CLI daemons and workers
* Compatible with PHP >= 5.6

## Installation
Install the latest version with [Composer](https://getcomposer.org/) by running

```bash
$ composer require maxbanton/cwh:^1.0
```

## Upgrade
Upgrade to the lastest version with [Composer](https://getcomposer.org/) by running

```
$ composer require maxbanton/cwh:^1.0 --update-with-dependencies
```

and change your code from

```php
<?php

use Maxbanton\Cwh\Handler\CloudWatch;

// Instantiate handler
$handler = new CloudWatch($client, $logGroupName, $logStreamName, $daysToRetention);
```
to

```php
<?php

use Maxbanton\Cwh\Handler\CloudWatch;

// Instantiate handler (tags are optional)
$handler = new CloudWatch($client, $groupName, $streamName, $retentionDays, 10000, ['my-awesome-tag' => 'tag-value']);
$ composer require maxbanton/cwh:^2.0
```

## Basic Usage
Expand Down Expand Up @@ -162,12 +137,3 @@ Feel free to [report any issues](https://github.com/maxbanton/cwh/issues/new)

## Contributing
Please check [this document](https://github.com/maxbanton/cwh/blob/master/CONTRIBUTING.md)

## Donate
If you would like to, you can send any amount of BTC to the wallet `12d3VXfvPiQ5bFMfPppGqpwnNSkZwigBVt`

![Donate BTC](https://monosnap.com/file/uv8lk8VrWzEywdUCmkfy4NCRg9qok3.png)

or ETHER to the wallet `0xd6C9d9Af4b03a11223C67067782E30194D9adAEb`

![Donate ETHER](https://monosnap.com/image/4nsT44MoNd7Y4OkC9rJWmy1yyvCh8r.png)
22 changes: 9 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "maxbanton/cwh",
"homepage": "https://github.com/maxbanton/cwh",
"type": "library",
"description": "AWS CloudWatch Handler for Monolog library",
"keywords": [
Expand All @@ -20,15 +21,15 @@
"source": "https://github.com/maxbanton/cwh"
},
"require": {
"php": ">=5.6.0",
"aws/aws-sdk-php": "^3.18",
"monolog/monolog": "^1.20"
"php": "^7.2",
"monolog/monolog": "^2.0",
"aws/aws-sdk-php": "^3.18"
},
"require-dev": {
"maxbanton/dd": "^1.0",
"php-coveralls/php-coveralls": "^2.0",
"phpunit/phpunit": "^5.6",
"squizlabs/php_codesniffer": "2.*"
"maxbanton/dd": "^2.0",
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5",
"php-coveralls/php-coveralls": "^2.2"
},
"config": {
"preferred-install": "dist"
Expand All @@ -38,10 +39,5 @@
"Maxbanton\\Cwh\\": "src"
}
},
"minimum-stability": "stable",
"scripts": {
"check-syntax": "vendor/bin/phpcs --standard=psr2 --ignore=Tests src/",
"fix-syntax": "vendor/bin/phpcbf --standard=psr2 src/",
"tests": "vendor/bin/phpunit"
}
"minimum-stability": "stable"
}
Loading

0 comments on commit 7ea138d

Please sign in to comment.