Skip to content

Commit 3ac0b41

Browse files
committed
add tests
1 parent 5abf911 commit 3ac0b41

File tree

11 files changed

+1158
-10
lines changed

11 files changed

+1158
-10
lines changed
Lines changed: 141 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,142 @@
1-
# Documentation conventions
1+
# Laravel Docs - Functional Documentation Guidelines
22

3+
This project uses the `xentral/laravel-docs` package to automatically generate documentation from PHPDoc comments using the `@functional` annotation.
4+
5+
## How to Write Functional Documentation
6+
7+
### Basic Structure
8+
9+
```php
10+
/**
11+
* Brief summary of the class/method
12+
*
13+
* @functional
14+
* Detailed description of the functionality. This can span multiple lines
15+
* and supports full Markdown formatting.
16+
*
17+
* # Features
18+
* - Feature 1: Description
19+
* - Feature 2: Description
20+
*
21+
* @nav Navigation / Path / For This Doc
22+
* @uses \App\Models\User
23+
* @uses \App\Services\EmailService
24+
* @link https://example.com/related-docs
25+
*/
26+
```
27+
28+
### Required Annotations
29+
30+
- **`@functional`**: Must be present to include the documentation in generation
31+
- All other annotations are optional but recommended
32+
33+
### Optional Annotations
34+
35+
- **`@nav Path / To / Documentation`**: Defines where this appears in the navigation
36+
- **`@uses \Fully\Qualified\ClassName`**: Links to dependencies for relationship mapping
37+
- **`@link URL`** or **`@links [Title](URL)`**: External references
38+
39+
### Best Practices
40+
41+
1. **Be Descriptive**: Explain the "why" and "how", not just the "what"
42+
2. **Use Markdown**: Headers, lists, code blocks, and links are all supported
43+
3. **Group Related Items**: Use consistent navigation paths for related functionality
44+
4. **Document Dependencies**: Use `@uses` to show relationships between components
45+
5. **Add Examples**: Include code examples where helpful
46+
47+
### Navigation Structure
48+
49+
Organize your documentation using consistent navigation paths:
50+
51+
```
52+
Authentication/
53+
├── Login Process
54+
├── Password Reset
55+
└── Session Management
56+
57+
User Management/
58+
├── User Registration
59+
├── Profile Updates
60+
└── Account Deletion
61+
```
62+
63+
### Markdown Features
64+
65+
Full Markdown support includes:
66+
67+
- **Headers** (automatically demoted by one level)
68+
- **Lists** and nested lists
69+
- **Code blocks** with syntax highlighting
70+
- **Mermaid diagrams** for flowcharts
71+
- **Links** and images
72+
- **Tables** and formatting
73+
74+
### Example Documentation
75+
76+
```php
77+
/**
78+
* Payment processing service
79+
*
80+
* @functional
81+
* This service handles all payment operations including processing payments,
82+
* refunds, and subscription management. It integrates with multiple payment
83+
* gateways and provides a unified interface for payment operations.
84+
*
85+
* # Key Features
86+
* - **Multi-gateway Support**: Stripe, PayPal, Square
87+
* - **Subscription Management**: Recurring billing and plan changes
88+
* - **Fraud Protection**: Built-in fraud detection and prevention
89+
*
90+
* ## Usage Example
91+
*
92+
* ```php
93+
* $payment = $paymentService->processPayment([
94+
* 'amount' => 2999, // $29.99
95+
* 'currency' => 'USD',
96+
* 'customer_id' => $user->id,
97+
* ]);
98+
* ```
99+
*
100+
* ## Error Handling
101+
*
102+
* The service throws specific exceptions for different failure modes:
103+
* - `PaymentDeclinedException` for declined cards
104+
* - `InsufficientFundsException` for NSF situations
105+
* - `InvalidPaymentMethodException` for invalid payment methods
106+
*
107+
* @nav Payments / Payment Processing
108+
* @uses \App\Models\User
109+
* @uses \App\Models\PaymentMethod
110+
* @uses \App\Services\FraudDetectionService
111+
* @link https://stripe.com/docs/api
112+
*/
113+
```
114+
115+
## Generating Documentation
116+
117+
```bash
118+
# Generate documentation
119+
php artisan mkdocs:generate
120+
121+
# Serve documentation locally
122+
php artisan mkdocs:serve
123+
124+
# Generate with custom output path
125+
php artisan mkdocs:generate --path=/custom/docs/path
126+
```
127+
128+
## Configuration
129+
130+
Configure paths to scan in `config/docs.php`:
131+
132+
```php
133+
'paths' => [
134+
app_path(),
135+
base_path('packages/'),
136+
// Add other directories to scan
137+
],
138+
```
139+
140+
---
141+
142+
For more information, see the package documentation at https://github.com/xentral/laravel-docs

.junie/mcp/mcp.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"mcpServers": {
3+
"laravel-boost": {
4+
"command": "/Users/bambamboole/Library/Application Support/Herd/bin/php82",
5+
"args": [
6+
"/Users/bambamboole/Projects/laravel-docs/vendor/orchestra/testbench-core/laravel/artisan",
7+
"boost:mcp"
8+
]
9+
}
10+
}
11+
}

.mcp.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"mcpServers": {
3+
"laravel-boost": {
4+
"command": "php",
5+
"args": [
6+
"./artisan",
7+
"boost:mcp"
8+
]
9+
}
10+
}
11+
}

CLAUDE.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<laravel-boost-guidelines>
2+
=== foundation rules ===
3+
4+
# Laravel Boost Guidelines
5+
6+
The Laravel Boost guidelines are specifically curated by Laravel maintainers for this application. These guidelines should be followed closely to enhance the user's satisfaction building Laravel applications.
7+
8+
## Foundational Context
9+
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
10+
11+
- php - 8.2.29
12+
13+
14+
## Conventions
15+
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, naming.
16+
- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.
17+
- Check for existing components to reuse before writing a new one.
18+
19+
## Verification Scripts
20+
- Do not create verification scripts or tinker when tests cover that functionality and prove it works. Unit and feature tests are more important.
21+
22+
## Application Structure & Architecture
23+
- Stick to existing directory structure - don't create new base folders without approval.
24+
- Do not change the application's dependencies without approval.
25+
26+
## Frontend Bundling
27+
- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `npm run build`, `npm run dev`, or `composer run dev`. Ask them.
28+
29+
## Replies
30+
- Be concise in your explanations - focus on what's important rather than explaining obvious details.
31+
32+
## Documentation Files
33+
- You must only create documentation files if explicitly requested by the user.
34+
35+
36+
=== boost rules ===
37+
38+
## Laravel Boost
39+
- Laravel Boost is an MCP server that comes with powerful tools designed specifically for this application. Use them.
40+
41+
## Artisan
42+
- Use the `list-artisan-commands` tool when you need to call an Artisan command to double check the available parameters.
43+
44+
## URLs
45+
- Whenever you share a project URL with the user you should use the `get-absolute-url` tool to ensure you're using the correct scheme, domain / IP, and port.
46+
47+
## Tinker / Debugging
48+
- You should use the `tinker` tool when you need to execute PHP to debug code or query Eloquent models directly.
49+
- Use the `database-query` tool when you only need to read from the database.
50+
51+
## Reading Browser Logs With the `browser-logs` Tool
52+
- You can read browser logs, errors, and exceptions using the `browser-logs` tool from Boost.
53+
- Only recent browser logs will be useful - ignore old logs.
54+
55+
## Searching Documentation (Critically Important)
56+
- Boost comes with a powerful `search-docs` tool you should use before any other approaches. This tool automatically passes a list of installed packages and their versions to the remote Boost API, so it returns only version-specific documentation specific for the user's circumstance. You should pass an array of packages to filter on if you know you need docs for particular packages.
57+
- The 'search-docs' tool is perfect for all Laravel related packages, including Laravel, Inertia, Livewire, Filament, Tailwind, Pest, Nova, Nightwatch, etc.
58+
- You must use this tool to search for Laravel-ecosystem documentation before falling back to other approaches.
59+
- Search the documentation before making code changes to ensure we are taking the correct approach.
60+
- Use multiple, broad, simple, topic based queries to start. For example: `['rate limiting', 'routing rate limiting', 'routing']`.
61+
- Do not add package names to queries - package information is already shared. For example, use `test resource table`, not `filament 4 test resource table`.
62+
63+
### Available Search Syntax
64+
- You can and should pass multiple queries at once. The most relevant results will be returned first.
65+
66+
1. Simple Word Searches with auto-stemming - query=authentication - finds 'authenticate' and 'auth'
67+
2. Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "rate" AND "limit"
68+
3. Quoted Phrases (Exact Position) - query="infinite scroll" - Words must be adjacent and in that order
69+
4. Mixed Queries - query=middleware "rate limit" - "middleware" AND exact phrase "rate limit"
70+
5. Multiple Queries - queries=["authentication", "middleware"] - ANY of these terms
71+
72+
73+
=== php rules ===
74+
75+
## PHP
76+
77+
- Always use curly braces for control structures, even if it has one line.
78+
79+
### Constructors
80+
- Use PHP 8 constructor property promotion in `__construct()`.
81+
- <code-snippet>public function __construct(public GitHub $github) { }</code-snippet>
82+
- Do not allow empty `__construct()` methods with zero parameters.
83+
84+
### Type Declarations
85+
- Always use explicit return type declarations for methods and functions.
86+
- Use appropriate PHP type hints for method parameters.
87+
88+
<code-snippet name="Explicit Return Types and Method Params" lang="php">
89+
protected function isAccessible(User $user, ?string $path = null): bool
90+
{
91+
...
92+
}
93+
</code-snippet>
94+
95+
## Comments
96+
- Prefer PHPDoc blocks over comments. Never use comments within the code itself unless there is something _very_ complex going on.
97+
98+
## PHPDoc Blocks
99+
- Add useful array shape type definitions for arrays when appropriate.
100+
101+
## Enums
102+
- Typically, keys in an Enum should be TitleCase. For example: `FavoritePerson`, `BestLake`, `Monthly`.
103+
104+
105+
=== .ai/documentation rules ===
106+
107+
# Documentation conventions
108+
</laravel-boost-guidelines>

0 commit comments

Comments
 (0)