-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6d01e5e
Showing
63 changed files
with
18,991 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,15 @@ | ||
; This file is for unifying the coding style for different editors and IDEs. | ||
; More information at http://editorconfig.org | ||
|
||
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 |
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,11 @@ | ||
# Path-based git attributes | ||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html | ||
|
||
# Ignore all test and documentation with "export-ignore". | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.travis.yml export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/.scrutinizer.yml export-ignore | ||
/tests export-ignore | ||
/.editorconfig 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,49 @@ | ||
name: Build | ||
on: [push] | ||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
matrix: | ||
php: [8.0, 8.1] | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Checkout | ||
if: github.ref == 'refs/heads/main' | ||
run: git checkout "${GITHUB_REF:11}" | ||
- name: Setup PHP with PECL extension | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
- uses: shogo82148/actions-setup-redis@v1 | ||
with: | ||
redis-version: '6.x' | ||
- run: redis-cli ping | ||
- name: Composer Install | ||
run: composer install | ||
- name: Run Tests | ||
run: ./vendor/bin/phpunit | ||
- name: Coveralls | ||
if: github.ref == 'refs/heads/main' | ||
run: ./vendor/bin/php-coveralls -v --coverage_clover build/coverage.xml --json_path build/coveralls-upload.json | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
release: | ||
name: Release | ||
if: github.ref == 'refs/heads/main' | ||
needs: test | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npx semantic-release@18 |
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,43 @@ | ||
name: PHP CS Fixer | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
php-cs-fixer: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Cancel Previous Run | ||
uses: styfle/cancel-workflow-action@0.6.0 | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, exif, imagick, bcmath, intl | ||
coverage: none | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install Composer dependencies | ||
run: composer install --ignore-platform-reqs | ||
|
||
- name: Run PHP CS Fixer | ||
run: composer fix | ||
|
||
- uses: EndBug/add-and-commit@v7 # You can change this to use a specific version. | ||
with: | ||
add: 'app' | ||
message: 'chore(style): Apply PHP CS Fixer changes' |
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,9 @@ | ||
build | ||
composer.lock | ||
docs | ||
vendor | ||
coverage | ||
.phpunit.result.cache | ||
.php-cs-fixer.cache | ||
/node_modules | ||
/public |
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,35 @@ | ||
<?php | ||
|
||
// Reference: http://cs.sensiolabs.org/ | ||
// Usage: php-cs-fixer fix app | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__) | ||
->exclude(['bootstrap', 'storage', 'vendor', 'spec', 'nova', 'ssh', 'public', 'database/migrations']) | ||
->name('*.php') | ||
->name('_ide_helper') | ||
->notName('*.blade.php') | ||
->ignoreDotFiles(true) | ||
->ignoreVCS(true); | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PSR2' => true, | ||
'@Symfony' => true, | ||
'@PHP70Migration' => true, | ||
'@PHP71Migration' => true, | ||
'multiline_whitespace_before_semicolons' => false, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'simplified_null_return' => false, | ||
'strict_comparison' => true, | ||
'strict_param' => false, | ||
'yoda_style' => false, | ||
'ordered_imports' => ['sort_algorithm' => 'alpha'], | ||
'no_unused_imports' => true, | ||
'no_extra_blank_lines' => ['tokens' => ['break', 'case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'switch', 'throw', 'use', 'use_trait']], | ||
'phpdoc_add_missing_param_annotation' => false, | ||
'phpdoc_separation' => false, | ||
'phpdoc_align' => ['align' => 'left'], | ||
]) | ||
->setFinder($finder); |
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 @@ | ||
branches: ['+([0-9])?(.{+([0-9]),x}).x', 'main', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}] | ||
plugins: | ||
- '@semantic-release/commit-analyzer' | ||
- '@semantic-release/release-notes-generator' | ||
- '@semantic-release/github' |
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,3 @@ | ||
# Changelog | ||
|
||
See [Releases](https://github.com/AryeoHQ/monitored-jobs/releases) |
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,55 @@ | ||
# Contributing | ||
|
||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
Please read and understand the contribution guide before creating an issue or pull request. | ||
|
||
## Etiquette | ||
|
||
This project is open source, and as such, the maintainers give their free time to build and maintain the source code | ||
held within. They make the code freely available in the hope that it will be of use to other developers. It would be | ||
extremely unfair for them to suffer abuse or anger for their hard work. | ||
|
||
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the | ||
world that developers are civilized and selfless people. | ||
|
||
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient | ||
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. | ||
|
||
## Viability | ||
|
||
When requesting or submitting new features, first consider whether it might be useful to others. Open | ||
source projects are used by many developers, who may have entirely different needs to your own. Think about | ||
whether or not your feature is likely to be used by other users of the project. | ||
|
||
## Procedure | ||
|
||
Before filing an issue: | ||
|
||
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. | ||
- Check to make sure your feature suggestion isn't already present within the project. | ||
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress. | ||
- Check the pull requests tab to ensure that the feature isn't already in progress. | ||
|
||
Before submitting a pull request: | ||
|
||
- Check the codebase to ensure that your feature doesn't already exist. | ||
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix. | ||
|
||
## Requirements | ||
|
||
If the project maintainer has any additional requirements, you will find them listed here. | ||
|
||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer). | ||
|
||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests. | ||
|
||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
|
||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option. | ||
|
||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
|
||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. | ||
|
||
**Happy coding**! |
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 @@ | ||
MIT License | ||
|
||
Copyright (c) Owen Conti | ||
|
||
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,65 @@ | ||
# Monitored Jobs for Laravel | ||
|
||
## Overview | ||
|
||
This package tracks the status and history of your queued jobs by hooking into the events that Laravel fires for its queue system. | ||
|
||
We store this data in a database table, `monitored_jobs`. | ||
|
||
## Installation | ||
|
||
`composer require aryeo/monitored-jobs` | ||
|
||
## Configuration | ||
|
||
You can optionally publish the configuration file, which allows you to configure: | ||
|
||
- if monitoring is enabled | ||
- which jobs to monitor | ||
- the number of days to keep monitored job history before pruning | ||
|
||
To publish the config file: | ||
|
||
`php artisan vendor:publish --tag=monitored-jobs` | ||
|
||
### Controlling monitoring | ||
|
||
To control whether _any_ job is monitored, set the `monitored-jobs.enabled` configuration value. | ||
|
||
There are two configuration options for filtering which jobs are monitored: `include_jobs` and `exclude_jobs`. The default value for both config options is `null`, which will include any job class. | ||
|
||
- `'include_jobs' => null` means we are not setting the config option, so all jobs are monitored | ||
- `'include_jobs' => []` means we are setting the config option to include no jobs, meaning no jobs are monitored | ||
|
||
#### Including and excluding the same job class | ||
|
||
The `exclude_jobs` option will be checked first and will skip monitoring the job if it is found to be excluded. | ||
|
||
### Pruning Monitored Jobs | ||
|
||
The `MonitoredJob` model is setup to use Laravel's model pruning: https://laravel.com/docs/8.x/eloquent#pruning-models. | ||
|
||
In order for the models to be pruned, you must setup the command via the scheduler: | ||
|
||
``` | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
$schedule->command('model:prune')->daily(); | ||
} | ||
``` | ||
|
||
You can adjust how long the monitored job records are kept for via the config file: | ||
|
||
``` | ||
'prune_after_days' => 14, | ||
``` | ||
|
||
## Tags | ||
|
||
The package will attempt to pull tags off of job classes. It does this by either using the `tags` method on the job class, or by pulling the arguments off of the job's constructor. When pulling the arguments off the constructor: | ||
|
||
- Models & collections of models will be serialized as `{$class}_{$KEY}` | ||
- Arrays will be JSON encoded | ||
- Booleans will be converted to "true" / "false" strings | ||
- Strings and numbers will be stored as-is | ||
- Objects will not be stored as tags |
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,60 @@ | ||
{ | ||
"name": "aryeo/monitored-jobs", | ||
"description": "Monitor for your Laravel jobs.", | ||
"keywords": [ | ||
"aryeo", | ||
"laravel", | ||
"jobs", | ||
"monitor", | ||
"queue" | ||
], | ||
"homepage": "https://github.com/AryeoHQ/monitored-jobs", | ||
"license": "MIT", | ||
"type": "library", | ||
"authors": [ | ||
{ | ||
"name": "Owen Conti", | ||
"email": "owen@ohseemedia.com", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=8.0", | ||
"illuminate/support": "^8.73", | ||
"inertiajs/inertia-laravel": "^0.4.5" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^3.3", | ||
"laravel/legacy-factories": "^1.0.4", | ||
"orchestra/testbench": "^6.7", | ||
"php-coveralls/php-coveralls": "^2.4", | ||
"phpunit/phpunit": "^9.5", | ||
"squizlabs/php_codesniffer": "*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Aryeo\\MonitoredJobs\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Aryeo\\MonitoredJobs\\Tests\\": "tests" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "vendor/bin/phpunit", | ||
"test-coverage": "vendor/bin/phpunit --coverage-html coverage", | ||
"fix": "./vendor/bin/php-cs-fixer fix --config .php-cs-fixer.dist.php src tests", | ||
"lint": "composer fix -- --dry-run" | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Aryeo\\MonitoredJobs\\MonitoredJobsServiceProvider" | ||
] | ||
} | ||
} | ||
} |
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,8 @@ | ||
<?php | ||
|
||
return [ | ||
'enabled' => env('MONITORED_JOBS_ENABLED', true), | ||
'prune_after_days' => 14, | ||
'include_jobs' => null, | ||
'exclude_jobs' => null, | ||
]; |
Oops, something went wrong.