Skip to content

Commit

Permalink
PG-15 (#2)
Browse files Browse the repository at this point in the history
v73.0.0
  • Loading branch information
gammamatrix authored Nov 26, 2023
1 parent 9634e3e commit b549036
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 56 deletions.
16 changes: 12 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.editorconfig export-ignore
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.phpunit.cache export-ignore
/phpunit.xml export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.php-cs-fixer.cache export-ignore
/.php-cs-fixer.dist export-ignore
/.phpunit.cache export-ignore
# Database components are for testing only.
/database export-ignore
/docs export-ignore
/resources/docs export-ignore
/tests export-ignore
/vendor export-ignore
/composer.lock export-ignore
/package.json export-ignore
/phpunit.xml export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
/psalm.xml.dist export-ignore
/testbench.yaml export-ignore
4 changes: 3 additions & 1 deletion .php-cs-fixer.dist
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,13 @@ $rules_laravel = [
$finder = PhpCsFixer\Finder::create()
->in([
__DIR__ . '/config',
// __DIR__ . '/database',
// __DIR__ . '/lang',
// __DIR__ . '/resources',
__DIR__ . '/routes',
__DIR__ . '/src',
__DIR__ . '/tests',
// __DIR__ . '/tests/Feature',
__DIR__ . '/tests/Unit',
])
->name('*.php')
->notName('*.blade.php')
Expand Down
68 changes: 40 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# playground-matrix-resource
# Playground Matrix Resource

The playground-matrix-resource Laravel package.
The `playground-matrix-resource` Laravel package.

This package provides an API and a Blade UI for interacting with the Playground Matrix.
This package provides an API and a Blade UI for interacting with the [Playground Matrix](https://github.com/gammamatrix/playground-matrix), a project management and task system.

If you only need the JSON API, the Blade UI may be disabled.

This application provides Swagger documentation: [swagger.json](swagger.json).
- See the [Playground Matrix Resource swagger.json on the Swagger Editor.](https://editor.swagger.io/?url=https://raw.githubusercontent.com/gammamatrix/playground-matrix-resource/develop/swagger.json)
- The endpoint models support locks, trash with force delete, restoring and more.
- Index endpoints support advanced query filtering.

## Installation

Expand All @@ -13,18 +20,22 @@ composer require gammamatrix/playground-matrix-resource
```

You can publish the config file with:

```bash
php artisan vendor:publish --provider="GammaMatrix\Playground\Matrix\Resource\ServiceProvider" --tag="playground-config"
```

## Configuration

All routes are enabled by default. They may be disabled via enviroment variable or the configuration.

See the contents of the published config file: [config/playground-matrix-resource.php](config/playground-matrix-resource.php)

You can publish the routes file with:
```bash
php artisan vendor:publish --provider="GammaMatrix\Playground\Matrix\Resource\ServiceProvider" --tag="playground-routes"
```

See the authentication routes: [routes](routes)
- The routes while be published in a folder at `routes/playground-matrix-resource`

### Environment Variables

Expand All @@ -37,7 +48,7 @@ See the authentication routes: [routes](routes)

If you do not want to use the flexible policies available in Playground, you may publish the routes to your base application and customize them and the middleware.

The default middleware is set in [config/playground-matrix-resource.php](config/playground-matrix-resource.php) (may also be published): `'auth:sanctum,web'`
The default middleware is set in [config/playground-matrix-resource.php](config/playground-matrix-resource.php) (may also be published): `auth:sanctum,web`

If you wish to use your own policies, copy from [src/Policies](src/Policies).

Expand All @@ -51,23 +62,25 @@ If you wish to use your own policies, copy from [src/Policies](src/Policies).

##### Routes

| env() | config() |
|------------------------------------------------|---------------------------------------|
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_MATRIX` | `playground-matrix.routes.matrix` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_BOARDS` | `playground-matrix.routes.backlogs` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_EPICS` | `playground-matrix.routes.boards` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_FLOWS` | `playground-matrix.routes.epics` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_MILESTONES` | `playground-matrix.routes.milestones` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_NOTES` | `playground-matrix.routes.notes` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_PROJECTS` | `playground-matrix.routes.projects` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_RELEASES` | `playground-matrix.routes.releases` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_ROADMAPS` | `playground-matrix.routes.roadmaps` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_SOURCES` | `playground-matrix.routes.sources` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_SPRINTS` | `playground-matrix.routes.sprints` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_TAGS` | `playground-matrix.routes.tags` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_TEAMS` | `playground-matrix.routes.teams` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_TICKETS` | `playground-matrix.routes.tickets` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_VERSIONS` | `playground-matrix.routes.versions` |
See the matrix routes: [routes](routes)

| env() | config() |
|------------------------------------------------|------------------------------------------------|
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_MATRIX` | `playground-matrix-resource.routes.matrix` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_BOARDS` | `playground-matrix-resource.routes.backlogs` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_EPICS` | `playground-matrix-resource.routes.boards` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_FLOWS` | `playground-matrix-resource.routes.epics` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_MILESTONES` | `playground-matrix-resource.routes.milestones` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_NOTES` | `playground-matrix-resource.routes.notes` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_PROJECTS` | `playground-matrix-resource.routes.projects` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_RELEASES` | `playground-matrix-resource.routes.releases` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_ROADMAPS` | `playground-matrix-resource.routes.roadmaps` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_SOURCES` | `playground-matrix-resource.routes.sources` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_SPRINTS` | `playground-matrix-resource.routes.sprints` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_TAGS` | `playground-matrix-resource.routes.tags` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_TEAMS` | `playground-matrix-resource.routes.teams` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_TICKETS` | `playground-matrix-resource.routes.tickets` |
| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_VERSIONS` | `playground-matrix-resource.routes.versions` |

### UI

Expand All @@ -80,11 +93,6 @@ If you wish to use your own policies, copy from [src/Policies](src/Policies).
| `PLAYGROUND_MATRIX_RESOURCE_SITEMAP_USER` | `playground-matrix-resource.sitemap.user` |
| `PLAYGROUND_MATRIX_RESOURCE_SITEMAP_VIEW` | `playground-matrix-resource.sitemap.view` |

## Configuration

All routes are enabled by default. They may be disabled via enviroment variable or the configuration.

See the contents of the published config file: [config/playground-matrix-resource.php](.config/playground-matrix-resource.php)

## Migrations

Expand All @@ -95,7 +103,11 @@ This package requires the migrations in [playground-matrix](https://github.com/g
```sh
composer test
```
## About

Playground provides information in the `artisan about` command.

<img src="resources/docs/artisan-about-playground-matrix-resource.png" alt="screenshot of artisan about command with Playground Matrix Resource.">

## Changelog

Expand Down
18 changes: 3 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,13 @@
],
"homepage": "https://github.com/gammamatrix/playground-matrix-resource",
"license": "MIT",
"version": "73.0.0",
"authors": [
{
"name": "Jeremy Postlethwaite",
"email": "[email protected]",
"role": "Developer"
}
],
"repositories": [
{
"type": "vcs",
"url": "[email protected]:gammamatrix/playground.git"
},
{
"type": "vcs",
"url": "[email protected]:gammamatrix/playground-matrix.git"
},
{
"type": "vcs",
"url": "[email protected]:gammamatrix/playground-test.git"
}
],
"require": {
"php": "^8.1",
"gammamatrix/playground": "dev-develop|dev-master|^73.0",
Expand All @@ -43,6 +28,9 @@
"require-dev": {
"gammamatrix/playground-test": "dev-develop|dev-master|^73.0"
},
"suggest": {
"gammamatrix/playground-matrix": "Provides the models used by the Resource API in this package."
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function boot()

if (!empty($config)) {

// $this->loadTranslationsFrom(
// dirname(__DIR__).'/resources/lang',
// 'playground-matrix-resource'
// );

if (!empty($config['load']['policies'])) {
$this->setPolicyNamespace($config);
$this->registerPolicies();
Expand All @@ -74,9 +79,15 @@ public function boot()
if ($this->app->runningInConsole()) {
// Publish configuration
$this->publishes([
dirname(__DIR__).'/config/'.$this->package.'.php'
dirname(__DIR__).'/config/playground-matrix-resource.php'
=> config_path($this->package.'.php')
], 'playground-config');

// Publish routes
$this->publishes([
dirname(__DIR__).'/routes'
=> base_path('routes/playground-matrix-resource')
], 'playground-routes');
}
}

Expand All @@ -91,7 +102,7 @@ public function boot()
public function register()
{
$this->mergeConfigFrom(
dirname(__DIR__) . '/config/'.$this->package.'.php',
dirname(__DIR__) . '/config/playground-matrix-resource.php',
$this->package
);
}
Expand Down Expand Up @@ -157,17 +168,21 @@ public function about()
$redirect = defined('\App\Providers\RouteServiceProvider::HOME') ? \App\Providers\RouteServiceProvider::HOME : null;

AboutCommand::add('Playground Matrix Resource', fn () => [
'<fg=yellow;options=bold>Load</> Policies' => !empty($config['load']['policies']) ? '<fg=green;options=bold>ENABLED</>' : '<fg=yellow;options=bold>DISABLED</>',
'<fg=yellow;options=bold>Load</> Routes' => !empty($config['load']['routes']) ? '<fg=green;options=bold>ENABLED</>' : '<fg=yellow;options=bold>DISABLED</>',
'<fg=yellow;options=bold>Load</> Views' => !empty($config['load']['views']) ? '<fg=green;options=bold>ENABLED</>' : '<fg=yellow;options=bold>DISABLED</>',

'<fg=blue;options=bold>View</> Layout' => $config['layout'],
'<fg=blue;options=bold>View</> [layout]' => sprintf('[%s]', $config['layout']),
'<fg=blue;options=bold>View</> [prefix]' => sprintf('[%s]', $config['view']),

'<fg=magenta;options=bold>Sitemap</> Views' => !empty($config['sitemap']['enable']) ? '<fg=green;options=bold>ENABLED</>' : '<fg=yellow;options=bold>DISABLED</>',
'<fg=magenta;options=bold>Sitemap</> Guest' => !empty($config['sitemap']['guest']) ? '<fg=green;options=bold>ENABLED</>' : '<fg=yellow;options=bold>DISABLED</>',
'<fg=magenta;options=bold>Sitemap</> User' => !empty($config['sitemap']['user']) ? '<fg=green;options=bold>ENABLED</>' : '<fg=yellow;options=bold>DISABLED</>',
'<fg=magenta;options=bold>Sitemap</> [view]' => sprintf('[%s]', $config['sitemap']['view']),

'<fg=cyan;options=bold>Policy</> [Middleware]' => sprintf('[%s]', implode(', ', $config['middleware'])),
'<fg=cyan;options=bold>Policy</> [namespace]' => sprintf('[%s]', $config['policy_namespace']),

'Package' => $this->package,
'Version' => $version,
]);
Expand Down
7 changes: 2 additions & 5 deletions swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@
}
],
"info": {
"title": "Stub",
"title": "Playground Matrix Resource",
"description": "",
"termsOfService": "",
"contact": {
"email": "[email protected]"
},
"version": "1.0.0"
"version": "73.0.0"
},
"externalDocs": {
"description": "",
Expand Down

0 comments on commit b549036

Please sign in to comment.