first commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
`castes/delegate-auth` is a Laravel package (PHP ^8.3, Laravel ^10|^11) installed via Composer on an existing Laravel project. Its primary purpose is to publish a configuration file (`delegate-auth.php`) into the host application's `config/` directory. Namespace: `Rodev\DelegateAuth`.
|
||||||
|
|
||||||
|
The package is still in scaffolding — several placeholder names from the generator template have not yet been replaced.
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
Install dependencies:
|
||||||
|
```bash
|
||||||
|
composer install
|
||||||
|
```
|
||||||
|
|
||||||
|
Run tests (via Orchestra Testbench):
|
||||||
|
```bash
|
||||||
|
vendor/bin/phpunit
|
||||||
|
# single file:
|
||||||
|
vendor/bin/phpunit tests/Path/To/TestFile.php
|
||||||
|
```
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
- **`src/DelegateAuthServiceProvider.php`** — registers the package. Merges the default config, binds a singleton under the `delegate-auth` key, and in `boot()` publishes config/migrations, loads routes, and loads views.
|
||||||
|
- **`src/Console/InstallCommand.php`** — Artisan command (`mon-package:install`) that calls `vendor:publish` for config and migrations.
|
||||||
|
- **`config/deletgate-auth.php`** — single key `encrypt_key` sourced from `DELEGATE_KEY` env var.
|
||||||
|
|
||||||
|
## Known Issues (scaffolding not yet cleaned up)
|
||||||
|
|
||||||
|
- Config filename typo: `deletgate-auth.php` should be `delegate-auth.php`. The service provider references the correct name, so this causes a runtime error.
|
||||||
|
- The class inside `DelegateAuthServiceProvider.php` is still named `MonPackageServiceProvider`.
|
||||||
|
- The service provider references `MonPackageClass` (the main service class) which does not exist yet.
|
||||||
|
- `composer.json` `extra.laravel` still declares the placeholder provider (`MonPackageServiceProvider`) and facade (`MonPackage`).
|
||||||
|
- `InstallCommand` still references `TonNamespace\\MonPackage\\MonPackageServiceProvider`.
|
||||||
|
- `tests/` directory does not exist yet (`autoload-dev` is configured for `Rodev\DelegateAuth\Tests\`).
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"name": "castes/delegate-auth",
|
||||||
|
"description": "Description de ton package",
|
||||||
|
"type": "library",
|
||||||
|
"license": "MIT",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Rodev",
|
||||||
|
"email": "romain@delanoe.pro"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": "^8.3",
|
||||||
|
"illuminate/support": "^10.0|^11.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"orchestra/testbench": "^8.0",
|
||||||
|
"phpunit/phpunit": "^10.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Rodev\\DelegateAuth\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Rodev\\DelegateAuth\\Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Rodev\\DelegateAuth\\DelegateAuthServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimum-stability": "stable"
|
||||||
|
}
|
||||||
Generated
+7620
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'encrypt_key' => env('DELEGATE_KEY'),
|
||||||
|
];
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Rodev\DelegateAuth\Console;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class InstallCommand extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'delegate-auth:install';
|
||||||
|
protected $description = 'Publie la configuration de delegate-auth';
|
||||||
|
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
$this->callSilent('vendor:publish', [
|
||||||
|
'--provider' => 'Rodev\\DelegateAuth\\DelegateAuthServiceProvider',
|
||||||
|
'--tag' => 'delegate-auth-config',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->info('Config publiée dans config/delegate-auth.php');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Rodev\DelegateAuth;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class DelegateAuthServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
$this->mergeConfigFrom(
|
||||||
|
__DIR__.'/../config/delegate-auth.php', 'delegate-auth'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
$this->publishes([
|
||||||
|
__DIR__.'/../config/delegate-auth.php' => config_path('delegate-auth.php'),
|
||||||
|
], 'delegate-auth-config');
|
||||||
|
|
||||||
|
if ($this->app->runningInConsole()) {
|
||||||
|
$this->commands([
|
||||||
|
Console\InstallCommand::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user