Skip to content

Commit

Permalink
Merge branch 'main' into add-more-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alphaolomi authored Aug 21, 2024
2 parents dae21bc + b909454 commit 6ad4e52
Show file tree
Hide file tree
Showing 32 changed files with 288 additions and 194 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

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

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
27 changes: 11 additions & 16 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/art export-ignore
/docs export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.php_cs.dist.php export-ignore
/psalm.xml export-ignore
/psalm.xml.dist export-ignore
/testbench.yaml export-ignore
/UPGRADING.md export-ignore
/phpstan.neon.dist export-ignore
/phpstan-baseline.neon export-ignore
/CHANGELOG.md export-ignore
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml.dist export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.php-cs-fixer.dist.php export-ignore
/art export-ignore
/docs export-ignore
/UPGRADING.md export-ignore
58 changes: 58 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Bug Report
description: Report an Issue or Bug with the Package
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
We're sorry to hear you have a problem. Can you help us solve it by providing the following details.
- type: textarea
id: what-happened
attributes:
label: What happened?
description: What did you expect to happen?
placeholder: I cannot currently do X thing because when I do, it breaks X thing.
validations:
required: true
- type: textarea
id: how-to-reproduce
attributes:
label: How to reproduce the bug
description: How did this occur, please add any config values used and provide a set of reliable steps if possible.
placeholder: When I do X I see Y.
validations:
required: true
- type: input
id: package-version
attributes:
label: Package Version
description: What version of our Package are you running? Please be as specific as possible
placeholder: 2.0.0
validations:
required: true
- type: input
id: php-version
attributes:
label: PHP Version
description: What version of PHP are you running? Please be as specific as possible
placeholder: 8.2.0
validations:
required: true
- type: dropdown
id: operating-systems
attributes:
label: Which operating systems does with happen with?
description: You may select more than one.
multiple: true
options:
- macOS
- Windows
- Linux
- type: textarea
id: notes
attributes:
label: Notes
description: Use this field to provide any other notes that you feel might be relevant to the issue.
validations:
required: false
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/alphaolomi/json-placeholder/discussions/new?category=q-a
about: Ask the community for help
- name: Request a feature
url: https://github.com/alphaolomi/json-placeholder/discussions/new?category=ideas
about: Share ideas for new features
- name: Report a security issue
url: https://github.com/alphaolomi/json-placeholder/security/policy
about: Learn how to notify us for sensitive bugs
11 changes: 9 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "monthly"
labels:
- "dependencies"
- "dependencies"

- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "monthly"
labels:
- "dependencies"
2 changes: 1 addition & 1 deletion .github/funding.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
patreon: alphaolomi
github: alphaolomi
7 changes: 4 additions & 3 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ permissions:
jobs:
dependabot:
runs-on: ubuntu-latest
timeout-minutes: 5
if: ${{ github.actor == 'dependabot[bot]' }}
steps:

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.6.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Auto-merge Dependabot PRs for semver-minor updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Auto-merge Dependabot PRs for semver-patch updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: Fix PHP code style issues

on: [push]
on:
push:
paths:
- '**.php'

permissions:
contents: write

jobs:
php-code-styling:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout code
Expand All @@ -13,9 +20,9 @@ jobs:
ref: ${{ github.head_ref }}

- name: Fix PHP code style issues
uses: aglipanci/laravel-pint-action@2.3.0
uses: aglipanci/laravel-pint-action@2.4

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Fix styling
34 changes: 17 additions & 17 deletions .github/workflows/tests.yml → .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@ name: Tests

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
release:
types: [ released ]

permissions:
contents: read
paths:
- '**.php'
- '.github/workflows/run-tests.yml'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'

jobs:
tests:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, windows-latest ]
php: [ 8.1 ]
stability: [ prefer-lowest, prefer-stable ]
os: [ubuntu-latest, windows-latest]
php: [8.3, 8.2, 8.1]
stability: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand All @@ -42,7 +39,10 @@ jobs:
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
run: vendor/bin/pest
run: vendor/bin/pest --ci
6 changes: 5 additions & 1 deletion .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ on:
release:
types: [released]

permissions:
contents: write

jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout code
Expand All @@ -21,7 +25,7 @@ jobs:
release-notes: ${{ github.event.release.body }}

- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: Update CHANGELOG
Expand Down
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
.idea
vendor
.php_cs
.php_cs.cache
.phpunit.cache
build
composer.lock
.phpunit.result.cache
coverage
docs
phpunit.xml
psalm.xml
vendor
.php-cs-fixer.cache

31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# Json Placeholder for PHP

[![Packagist Version](https://img.shields.io/packagist/v/alphaolomi/json-placeholder)](https://packagist.org/packages/alphaolomi/json-placeholder) [![Built with](https://img.shields.io/badge/built%20with-Saloon%20v2-blue)](https://github.com/sammyjo20/saloon) [![Tests](https://github.com/alphaolomi/json-placeholder/actions/workflows/tests.yml/badge.svg)](https://github.com/alphaolomi/json-placeholder/actions/workflows/tests.yml) [![Fix PHP code style issues](https://github.com/alphaolomi/json-placeholder/actions/workflows/fix-php-code-style-issues.yml/badge.svg)](https://github.com/alphaolomi/json-placeholder/actions/workflows/fix-php-code-style-issues.yml) ![Packagist Downloads](https://img.shields.io/packagist/dt/alphaolomi/json-placeholder)

<br>
[![Latest Version on Packagist](https://img.shields.io/packagist/v/alphaolomi/json-placeholder.svg?style=flat-square)](https://packagist.org/packages/alphaolomi/json-placeholder)
[![Tests](https://img.shields.io/github/actions/workflow/status/alphaolomi/json-placeholder/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/alphaolomi/json-placeholder/actions/workflows/run-tests.yml)
[![Total Downloads](https://img.shields.io/packagist/dt/alphaolomi/json-placeholder.svg?style=flat-square)](https://packagist.org/packages/alphaolomi/json-placeholder)

A PHP SDK for the [JSON Placeholder API](https://jsonplaceholder.typicode.com/).




## Installation

Use Composer to install this SDK
You can install the package via composer:

```
```bash
composer require alphaolomi/json-placeholder
```

Expand Down Expand Up @@ -80,19 +78,30 @@ foreach($results as $result) {

## Testing

Using Pest Testing Framework, run the following command to run the tests.

```
Using PestPHP Testing framework, run the following command to execute the tests.


```bash
composer test
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

## Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## Credits

- [Alpha Olomi](https://github.com/alpaholomi)
- [Alpha Olomi](https://github.com/alphaolomi)
- [All Contributors](../../contributors)

## License

Expand Down
Loading

0 comments on commit 6ad4e52

Please sign in to comment.