cleentfaar/tissue
Laravel package to speed up building UI and pages with reusable “tissue” components, helper utilities, and starter structure. Aims to simplify common app scaffolding and keep views consistent across projects with minimal setup.
Installation Add the package via Composer:
composer require cleentfaar/tissue
Publish the config (if available) with:
php artisan vendor:publish --provider="Cleentfaar\Tissue\TissueServiceProvider"
First Use Case: Centralized String Manipulation Tissue likely provides utility methods for common string operations (e.g., slugging, truncation). Test it in a controller or helper:
use Cleentfaar\Tissue\Facades\Tissue;
$slug = Tissue::slug('Hello World!'); // Output: "hello-world"
$truncated = Tissue::truncate('Long text...', 10); // Output: "Long text..."
Where to Look First
Cleentfaar\Tissue\Facades\Tissue for the primary API.Cleentfaar\Tissue\TissueServiceProvider for bindings and boot logic.Tissue::camelCase(), Tissue::snakeCase()).Replace repetitive string/array operations in controllers/models with Tissue calls:
// Before (boilerplate)
$title = str_replace(['-', '_'], ' ', $request->title);
$title = ucwords($title);
// After (centralized)
$title = Tissue::humanize($request->title);
Bind Tissue utilities to Laravel’s container for dependency injection:
// In a service class
public function __construct(private Tissue $tissue) {}
public function process(string $input): string {
return $this->tissue->slug($input);
}
Add custom methods by extending the core class or creating a decorator:
// app/Providers/TissueServiceProvider.php
public function boot() {
Tissue::extend('customMethod', function ($input) {
return strtoupper($input);
});
}
Usage:
Tissue::customMethod('hello'); // "HELLO"
If the package publishes config, override defaults in config/tissue.php:
'slug' => [
'separator' => '-', // Default: '-'
'lowercase' => true,
],
Mock Tissue in PHPUnit tests:
$this->partialMock(Tissue::class, ['slug'])
->shouldReceive('slug')
->with('test')
->andReturn('test-slug');
Outdated Package
laravel/framework) if critical.Lack of Documentation
php artisan tinker to explore:
\Cleentfaar\Tissue\Facades\Tissue::methods();
Namespace Collisions
Tissue as a facade, ensure no conflicts with other packages (e.g., Tissue in a custom namespace).Performance Overhead
Tissue::trim() with native trim() if called in tight loops).config/tissue.php).php artisan package:discover
Custom Facade Aliases
Override the facade in config/app.php:
'aliases' => [
'Tissue' => Cleentfaar\Tissue\Facades\CustomTissue::class,
],
Event Listeners
If Tissue triggers events (e.g., Tissue\Events\StringProcessed), listen in EventServiceProvider:
protected $listen = [
'Tissue\Events\StringProcessed' => [
'App\Listeners\LogProcessedString',
],
];
Middleware for Global Processing Use Tissue in middleware to pre-process requests/responses:
public function handle($request, Closure $next) {
$request->merge([
'slug' => Tissue::slug($request->title),
]);
return $next($request);
}
/** @var \Cleentfaar\Tissue\Facades\Tissue */
$tissue;
$originalSlug = Tissue::getMethod('slug');
How can I help you explore Laravel packages today?