farmaprom / translatable-exception
Exception that can be translated
Installs: 42 615
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 2
pkg:composer/farmaprom/translatable-exception
Requires
- php: ~5.4|~7.0|~8.0
This package is auto-updated.
Last update: 2025-12-10 17:20:32 UTC
README
Example usage
<?php use FarmaProm\TranslatableException\TranslatableException; require_once __DIR__ . '/vendor/autoload.php'; class MyException extends TranslatableException { public function getTranslationKey() { return 'my_key'; } public function getTranslationDomain() { return 'my_domain'; } } try { throw (new MyException())->setTranslationParams(['param' => 'test']); } catch (TranslatableException $e) { var_export($e); // Example usage with translator // $translator->trans($e->getTranslationKey(), $e->getTranslationParams(), $e->getTranslationDomain()); }