Skip to content

Commit c74b233

Browse files
committed
fix: upgrade to restify 10 tool
1 parent f736f96 commit c74b233

File tree

13 files changed

+3027
-2299
lines changed

13 files changed

+3027
-2299
lines changed

INSTALLER_README.md

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# Laravel Restify Installer
2+
3+
An automated installation and setup tool for [Laravel Restify](https://restify.binarcode.com) - a Laravel package for building JSON:API compliant REST APIs.
4+
5+
## Quick Start
6+
7+
```bash
8+
# Make the script executable (if not already)
9+
chmod +x install-restify.sh
10+
11+
# Run the installer
12+
./install-restify.sh
13+
```
14+
15+
## What This Tool Does
16+
17+
The installer automates the complete Laravel Restify setup process:
18+
19+
### ✅ Requirements Validation
20+
- Checks PHP version (>= 8.0)
21+
- Validates Laravel project structure
22+
- Verifies Laravel framework version compatibility
23+
24+
### 📦 Package Installation
25+
- Installs `binaryk/laravel-restify` via Composer
26+
- Handles minimum stability requirements automatically
27+
28+
### 🔧 Setup & Configuration
29+
- Runs `php artisan restify:setup` command
30+
- Publishes configuration files
31+
- Creates RestifyServiceProvider
32+
- Sets up the `app/Restify` directory structure
33+
- Generates base Repository class and UserRepository
34+
35+
### 🗃️ Database Setup
36+
- Prompts to run migrations
37+
- Optionally installs `doctrine/dbal` for mock data generation
38+
- Can generate sample user data with `restify:stub`
39+
40+
### ⚙️ Optional Configurations
41+
- **Sanctum Authentication**: Enable `auth:sanctum` middleware
42+
- **API Prefix**: Customize API endpoint prefix (default: `/api/restify`)
43+
- **Repository Generation**: Auto-generate repositories for existing models
44+
45+
## Features
46+
47+
### Interactive Setup
48+
The installer provides interactive prompts for optional features:
49+
- Enable/disable authentication middleware
50+
- Customize API prefix
51+
- Generate mock data
52+
- Auto-generate repositories for existing models
53+
54+
### Error Handling
55+
- Validates all requirements before installation
56+
- Provides clear error messages
57+
- Exits gracefully on failures
58+
59+
### Colored Output
60+
- Green ✅ for success messages
61+
- Red ❌ for errors
62+
- Yellow ⚠️ for warnings
63+
- Blue ℹ️ for information
64+
65+
## Requirements
66+
67+
- PHP >= 8.0
68+
- Laravel Framework >= 8.0
69+
- Composer installed
70+
- `bc` command (for version comparison)
71+
72+
## What Gets Created
73+
74+
After successful installation:
75+
76+
```
77+
config/
78+
├── restify.php # Main configuration
79+
80+
app/
81+
├── Providers/
82+
│ └── RestifyServiceProvider.php # Auto-registered service provider
83+
└── Restify/
84+
├── Repository.php # Base repository class
85+
└── UserRepository.php # Example user repository
86+
87+
database/migrations/
88+
└── xxxx_xx_xx_create_action_logs_table.php # Action logs migration
89+
```
90+
91+
## Usage Examples
92+
93+
### Basic Installation
94+
```bash
95+
./install-restify.sh
96+
```
97+
98+
### What You Get After Installation
99+
100+
1. **API Endpoints**: Immediate access to RESTful endpoints
101+
```
102+
GET /api/restify/users # List users
103+
POST /api/restify/users # Create user
104+
GET /api/restify/users/{id} # Show user
105+
PATCH /api/restify/users/{id} # Update user
106+
DELETE /api/restify/users/{id} # Delete user
107+
```
108+
109+
2. **JSON:API Compliance**: All responses follow JSON:API specification
110+
3. **Repository Pattern**: Clean separation of API logic from models
111+
4. **Built-in Features**: Filtering, sorting, pagination, field selection
112+
113+
### Post-Installation Commands
114+
115+
Generate new repositories:
116+
```bash
117+
php artisan restify:repository PostRepository
118+
php artisan restify:repository PostRepository --all # With model, policy, migration
119+
```
120+
121+
Generate repositories for all models:
122+
```bash
123+
php artisan restify:generate:repositories
124+
```
125+
126+
Generate policies:
127+
```bash
128+
php artisan restify:policy PostPolicy
129+
```
130+
131+
Create mock data:
132+
```bash
133+
php artisan restify:stub users --count=50
134+
```
135+
136+
## Configuration
137+
138+
### API Prefix
139+
Default: `/api/restify`
140+
Configure in `config/restify.php`:
141+
```php
142+
'base' => '/api/restify',
143+
```
144+
145+
### Middleware
146+
Default middleware stack in `config/restify.php`:
147+
```php
148+
'middleware' => [
149+
'api',
150+
'auth:sanctum', // Optional - enabled via installer
151+
Binaryk\LaravelRestify\Http\Middleware\DispatchRestifyStartingEvent::class,
152+
Binaryk\LaravelRestify\Http\Middleware\AuthorizeRestify::class,
153+
]
154+
```
155+
156+
### Authentication
157+
For Sanctum authentication, ensure you have:
158+
1. Laravel Sanctum installed and configured
159+
2. `auth:sanctum` middleware enabled (installer option)
160+
3. API tokens configured for your users
161+
162+
## Troubleshooting
163+
164+
### Minimum Stability Issues
165+
If you encounter minimum stability errors, the installer will suggest setting:
166+
```json
167+
{
168+
"minimum-stability": "dev",
169+
"prefer-stable": true
170+
}
171+
```
172+
173+
### Permission Issues
174+
Make sure the script is executable:
175+
```bash
176+
chmod +x install-restify.sh
177+
```
178+
179+
### Laravel Version Compatibility
180+
- Laravel 8.x → Restify <= 6.x
181+
- Laravel 9.x → Restify ^7.x
182+
- Laravel 10.x → Restify ^8.x
183+
184+
## Links
185+
186+
- [Laravel Restify Documentation](https://restify.binarcode.com)
187+
- [GitHub Repository](https://github.com/binaryk/laravel-restify)
188+
- [JSON:API Specification](https://jsonapi.org/)
189+
190+
## License
191+
192+
This installer tool is open-sourced software licensed under the MIT license.

0 commit comments

Comments
 (0)