Skip to content

Commit

Permalink
Major bug fixes and improvements (#11)
Browse files Browse the repository at this point in the history
* Github actions (#9)

Removed PHPLint
Removed CircleCI config
Added GitHub actions with multiple PHP version build check
Added namespace for Tests, at the moment the tests are with the same namespace as the source.

* Namespace fix (#10)

- Replaced namespaces and folder structure for the entire package.
- Removed direct composer autoload from files. (no idea why autoloader was directly loaded)

* added test for mappers and fix for misspelt lastUpdateTimestam to lastUpdateTimestamp

* updated namespaces on README.md

* spelling mistake fix on autoload

* clean up

* phpcs clean up

* phpcs PSR12 clean up

* code clean up

* fix for mapping issue

* added phpcs and style clean up

* fixed market holiday url and readme doc

* upgraded guzzle to 7.2

* added minimum php requirement to v7.2.5

* depricated public properties will be removed in next major version

* seperated test concerns

* moved rest to Rest

* Delete tests/rest directory

* added circlici back

* removed composer.lock

* Update php.yml

Updated branch

* Update php.yml

Added master branch to run configuration
  • Loading branch information
ersin-demirtas authored Apr 17, 2021
1 parent 0332465 commit f86dfc7
Show file tree
Hide file tree
Showing 171 changed files with 5,112 additions and 5,224 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ jobs:
key: composer-v1-{{ checksum "composer.lock" }}
paths:
- vendor
- run: ./vendor/bin/phplint .
- run: ./vendor/bin/phpunit
46 changes: 46 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: PHP Composer

on:
push:
branches: [ develop, master ]
pull_request:
branches: [ develop, master]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0']
steps:
- uses: actions/checkout@v2

- name: Setup PHP ${{ matrix.php-versions }} with tools
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phan, phpunit

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
#
# - name: Run linter
# run: composer lint

# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

- name: Run test suite
run: composer test
7 changes: 0 additions & 7 deletions .phplint.yml

This file was deleted.

16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ composer require polygon-io/api

## [Rest API](https://polygon.io/docs/#getting-started)

The `\PolygonIO\rest\Rest` class export 4 modules:
The `\PolygonIO\Rest\Rest` class export 4 modules:

- reference
- stocks
Expand All @@ -26,12 +26,12 @@ The `\PolygonIO\rest\Rest` class export 4 modules:

```
<?php
require __DIR__ . '/vendor/autload.php';
use PolygonIO\rest\Rest;
require __DIR__ . '/vendor/autoload.php';
use PolygonIO\Rest\Rest;
$rest = new Rest('your api key')
$rest = new Rest('your api key');
print_r($rest->forex->realtimeCurrencyConverion->get('USD', 'EUR', 10));
print_r($rest->forex->realTimeCurrencyConversion->get('USD', 'EUR', 10));
```

Expand All @@ -42,7 +42,7 @@ You can only use one websocket client by php thread since the event loop is in a

```
<?php
require __DIR__ . '/vendor/autload.php';
require __DIR__ . '/vendor/autoload.php';
use PolygonIO;
$client = new PolygonIO('your apiKey');
Expand All @@ -52,10 +52,10 @@ $client->websockets->forex(
function($data) {
// your handler function
}
)
);
```

## Developement
## Development

### prerequisite

Expand Down
25 changes: 20 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,34 @@
{
"name": "Julien Prugne",
"email": "[email protected]"
},
{
"name": "Ersin Demirtas",
"email": "[email protected]"
}
],
"require": {
"guzzlehttp/guzzle": "^6.4",
"amphp/websocket-client": "^0.2.4"
"php":">=7.2.5",
"ext-json": "*",
"guzzlehttp/guzzle": "^7.2.0",
"amphp/websocket-client": "^0.2.4",
"psr/http-client": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^8",
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
"psr-4": {
"PolygonIO\\": "src/"
}
},
"require-dev": {
"overtrue/phplint": "^1.1",
"phpunit/phpunit": "^8"
"autoload-dev": {
"psr-4": {
"PolygonIO\\Tests\\": "tests/"
}
},
"scripts": {
"test": "./vendor/bin/phpunit"
}
}
Loading

0 comments on commit f86dfc7

Please sign in to comment.