Skip to content

Commit 052d0da

Browse files
committed
Improve README
1 parent 4aff9e5 commit 052d0da

File tree

2 files changed

+57
-21
lines changed

2 files changed

+57
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
### Changed
1818
- Refactored `QueryBuilder` and `ApiModel` to use the new `ParsesApiResponse` trait, removing duplicate `parseResponse` implementations.
19+
- Improved README with installation details, key features, and basic-usage example.
1920

2021
### Fixed
2122
- Remote models hydrated from API responses are marked as existing to prevent local database queries.

README.md

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,77 @@
1-
# laravel-microservice-core
1+
# Laravel Microservice Core
22

33
[![Packagist Version](https://img.shields.io/packagist/v/kroderdev/laravel-microservice-core.svg)](https://packagist.org/packages/kroderdev/laravel-microservice-core)
44
[![Downloads](https://img.shields.io/packagist/dt/kroderdev/laravel-microservice-core.svg)](https://packagist.org/packages/kroderdev/laravel-microservice-core)
55
[![License](https://img.shields.io/packagist/l/kroderdev/laravel-microservice-core.svg)](LICENSE)
66

7-
A toolkit that turns **Laravel 12** into a lightweight base for distributed microservices.
7+
A toolkit that turns **Laravel 12** into a lightweight base for distributed microservices.
88

9-
## Features
9+
## Key Features
1010

11-
- Middleware for JWT validation, correlation IDs and permission checks
12-
- Authorization helpers using roles and permissions
13-
- HTTP client macros and an API Gateway client
14-
- Session guard and controllers for frontend authentication
15-
- Health check endpoint at `/api/health`
16-
- Base model for API gateway resources
11+
This package packages common microservice concerns so you can focus on your service logic:
1712

18-
---
19-
20-
## Documentation
21-
22-
See the [wiki](https://github.com/KroderDev/laravel-microservice-core/wiki) for full documentation.
23-
24-
---
13+
- JWT authentication middleware and a session guard for frontend interactions
14+
- Correlation ID propagation for tracing requests across services
15+
- Role and permission gates with convenient helpers
16+
- HTTP client macros and a configurable API Gateway client
17+
- Base model and query builder class for working with remote resources through the gateway
18+
- Optional health check endpoint out of the box
2519

2620
## Quick start
2721

28-
Install via Composer:
22+
Install the package via Composer:
2923

3024
```bash
3125
composer require kroderdev/laravel-microservice-core
3226
```
3327

34-
### Publish Configuration
35-
36-
After installation, publish the configuration file to your Laravel project:
28+
Publish the configuration to customize defaults:
3729

3830
```bash
3931
php artisan vendor:publish --provider="Kroderdev\LaravelMicroserviceCore\Providers\MicroserviceServiceProvider"
4032
```
4133

42-
You can now customize the settings to match your microservice environment.
34+
## Basic usage
35+
36+
Configure your API gateway URL and JWT settings in `config/microservice.php`.
37+
Then extend the base model to interact with remote resources:
38+
39+
Scaffold your remote model via the new Artisan command:
40+
41+
```bash
42+
php artisan make:model RemoteUser --remote
43+
```
44+
45+
This will generate a RemoteUser model that extends the core Model class with remote-resource support.
46+
47+
```php
48+
use Kroderdev\\LaravelMicroserviceCore\\Models\\Model;
49+
50+
class RemoteUser extends Model
51+
{
52+
protected static string $endpoint = '/users';
53+
protected $fillable = ['id', 'name'];
54+
}
55+
56+
$users = RemoteUser::all();
57+
```
58+
59+
Add the provided middleware to your routes to validate JWTs and propagate correlation IDs:
60+
61+
```php
62+
Route::middleware(['jwt.auth'])->group(function () {
63+
Route::get('/profile', fn () => 'ok');
64+
});
65+
```
66+
67+
## Documentation
68+
69+
Full documentation lives in the [project wiki](https://github.com/KroderDev/laravel-microservice-core/wiki).
70+
71+
## Contributing
72+
73+
Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
74+
75+
## License
76+
77+
This project is open-sourced software licensed under the [MIT license](LICENSE).

0 commit comments

Comments
 (0)