Skip to content

Commit

Permalink
Fully integrate the PHP library
Browse files Browse the repository at this point in the history
  • Loading branch information
3m1n3nc3 committed Sep 3, 2024
1 parent 46a8693 commit 5c0ecb6
Show file tree
Hide file tree
Showing 19 changed files with 419 additions and 11 deletions.
66 changes: 66 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
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: input
id: laravel-version
attributes:
label: Laravel Version
description: What version of Laravel are you running? Please be as specific as possible
placeholder: 9.0.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/toneflix/cuttly-laravel/issues/new?assignees=&labels=question
about: Ask the community for help
- name: Request a feature
url: https://github.com/toneflix/cuttly-laravel/issues/new?assignees=&labels=feature
about: Share ideas for new features
- name: Report a security issue
url: https://github.com/toneflix/cuttly-laravel/security/policy
about: Learn how to notify us for sensitive bugs
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
32 changes: 32 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: dependabot-auto-merge
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.2.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"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
27 changes: 27 additions & 0 deletions .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Fix PHP code style issues

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

permissions:
contents: write

jobs:
php-code-styling:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

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

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Fix styling
26 changes: 26 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PHPStan

on:
push:
paths:
- "**.php"
- "phpstan.neon.dist"

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
coverage: none

- name: Install composer dependencies
uses: ramsey/composer-install@v3

- name: Run PHPStan
run: ./vendor/bin/phpstan analyse --error-format=github ./src
72 changes: 72 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Run Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1, 8.2, 8.3]
laravel: [9.*, 10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
php: 8.1
- laravel: 11.*
testbench: 9.*
php: 8.2

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

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, bcmath, soap, intl, exif, fileinfo
coverage: xdebug

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install Matrix dependencies
if: ${{ matrix.testbench }}
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --dev
- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction

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

- name: 'Create env file'
run: |
touch .env
echo CUTTLY_API_KEY=${{ secrets.CUTTLY_API_KEY }} >> .env
echo CUTTLY_TEAM_API_KEY=${{ secrets.CUTTLY_TEAM_API_KEY }} >> .env
cat .env
- name: Execute tests
run: ./vendor/bin/pest --ci --coverage --display-errors --testdox
env:
XDEBUG_MODE: coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.5.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/logs/clover.xml
31 changes: 31 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Update Changelog"

on:
release:
types: [released]

permissions:
contents: write

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}

- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
composer.lock
/build
.DS_Store
.phpunit*
15 changes: 10 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Changelog

All notable changes to `laravel-resource-modifier` will be documented in this file
All notable changes to `cuttly-laravel` will be documented in this file

## v1.0.0 - 2024-08-28
## v2.0.0 - 2024-09-03

**Full Changelog**: https://github.com/toneflix/laravel-resource-modifier/commits/1.0.0
- Complete Rewrite of the package
- Remove support for Laravel ^8.0
- Add support for Laravel ^11.0
- Flunent chainable methods
- Improved error handling
- Separate concerns to a separate php library

## 1.0.0 - 201X-XX-XX
## v1.0.0 - 2022-05-22

- initial release
Initial Release
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"ToneflixCode\\Cuttly\\CuttlyServiceProvider"
],
"aliases": {
"Cuttly": "ToneflixCode\\Cuttly\\Facades\\Cuttly"
"Cuttly": "ToneflixCode\\Cuttly\\Facades\\CuttlyFacade"
}
}
}
Expand Down
9 changes: 8 additions & 1 deletion src/Cuttly.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@

use ToneflixCode\CuttlyPhp\Cuttly as CuttlyPhp;

class Cuttly extends CuttlyPhp {}
class Cuttly extends CuttlyPhp
{
public function __construct()
{
$this->apiKey = config('cuttly.key');
$this->teamApiKey = config('cuttly.team_key');
}
}
5 changes: 5 additions & 0 deletions src/CuttlyFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

use Illuminate\Support\Facades\Facade;

/**
* @method static \ToneflixCode\CuttlyPhp\Cuttly init()
* @method static \ToneflixCode\CuttlyPhp\Apis\CuttlyTeam team()
* @method static \ToneflixCode\CuttlyPhp\Apis\CuttlyRegular regular()
*/
class CuttlyFacade extends Facade
{
/**
Expand Down
5 changes: 1 addition & 4 deletions src/CuttlyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ public function register()

// Register the main class to use with the facade
$this->app->singleton('cuttly-laravel', function () {
return new Cuttly(
apiKey: config('cuttly.key'),
teamApiKey: config('cuttly.team_key'),
);
return new Cuttly();
});
}
}
Loading

0 comments on commit 5c0ecb6

Please sign in to comment.