assertchris/ellison
Laravel package that helps you build Ellison-style, class-based email templates with reusable components and a clean API. Designed to streamline email markup and keep designs consistent across messages while staying easy to maintain.
assertchris/ellison) focuses on natural language processing (NLP) for readability analysis, specifically identifying complex sentences and suboptimal word choices. This aligns well with:
Laravel Compatibility:
Key Dependencies:
| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| PHP Version Mismatch | High | Test against target PHP version early. |
| False Positives/Negatives | Medium | Validate against a labeled dataset (e.g., Flesch-Kincaid scores). |
| Performance Bottlenecks | Medium | Benchmark with expected input sizes; consider caching. |
| Limited Customization | Low | Extend the library via decorators or wrappers. |
| No Type Safety | Low | Add PHPStan/Nikita checks for input validation. |
artisan commands to audit existing content).composer require assertchris/ellison.use Ellison\Ellison;
$ellison = new Ellison();
$score = $ellison->analyze("This sentence is overly complex.");
// app/Providers/EllisonServiceProvider.php
public function register() {
$this->app->singleton(Ellison::class, function () {
return new Ellison();
});
}
Inject into controllers:
public function store(Request $request, Ellison $ellison) {
$text = $request->input('content');
$score = $ellison->analyze($text);
// Store score or reject if below threshold.
}
// app/Console/Commands/AuditReadability.php
public function handle() {
$posts = Post::all();
foreach ($posts as $post) {
$score = app(Ellison::class)->analyze($post->content);
$post->update(['readability_score' => $score]);
}
}
// Dispatch analysis job
AnalyzeReadabilityJob::dispatch($text)->onQueue('readability');
// Job class
public function handle() {
$score = app(Ellison::class)->analyze($this->text);
// Store result.
}
// app/Providers/BladeServiceProvider.php
Blade::directive('highlight', function ($expression) {
return "<?php echo app(\Ellison\Ellison::class)->highlight($expression); ?>";
});
Usage:
@highlight($post->content)
public function rules() {
return [
'content' => ['required', new ReadabilityRule(70)], // Min 70% score
];
}
composer.json.Dictionary class for domain jargon).Xdebug to step through analysis logic.How can I help you explore Laravel packages today?