scafera/integration
Scafera Integration is a lightweight Laravel package that connects your PHP application to Scafera services. It offers simple configuration, service bindings, and a clean, testable API so you can integrate quickly and reliably without boilerplate, keeping your codebase clean.
composer require <vendor>/<package>
php artisan vendor:publish --tag=<package>-config
class CreateUserRequest extends FormRequest
{
public function rules(): array
{
return [
'email' => ['required', 'email', 'unique:users,email'],
];
}
public function messages(): array
{
// Reference the stable rule ID, not the message text.
return [
'email.unique' => __('validation.rule_ids.unique_email'),
];
}
}
enum RuleId: string {
case UniqueEmail = 'unique_email';
case StrongPassword = 'strong_password';
}
app/Exceptions/Handler.php (or a dedicated ValidationException renderer), emit { "rule": "<stable-id>", "message": "..." }. Front-end clients can branch on the stable ID without parsing prose.id() (or equivalent) returning a stable string. Register it in the published config so the ID resolves during boot.assertJsonPath('errors.0.rule', RuleId::UniqueEmail->value)) rather than on translated strings — this survives message edits and locale changes.billing.tax_id).php artisan config:clear (and config:cache in production). Stale caches are the most common "my rule ID is missing" cause.app(<Registry>::class)->all()) or add a small artisan command that lists registered validators and IDs — invaluable when an ID "isn't found."messages() and use an ID→message map, be explicit about precedence; silent fallbacks to the package's default message are easy to miss.How can I help you explore Laravel packages today?