Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Skritphp Laravel Package

r0073rr0r/skritphp

SkritPHP is a lightweight PHP package for writing, organizing, and running reusable scripts with a clean, expressive API. It integrates smoothly with Laravel and standalone PHP projects with minimal setup, helping you automate tasks, simplify workflows, and keep script logic maintainable.

View on GitHub
Deep Wiki
Context7

Getting Started

SkritPHP 1.0.0 is the first stable release, so this is the right moment to adopt — the public surface is now frozen enough to build on. It ships a full PHP port of three Serbian cipher/codec transforms (satrovacki, utrovacki, leetrovacki) plus a "unified auto router" that picks a codec for you, wrapped in a standard Laravel package (ServiceProvider, Facade, publishable config) with a Livewire demo.

Minimal path to first output:

  1. composer require the package (confirm the exact vendor/name from the README — the repo is r0073rr0r/SkritPHP, but the Packagist name may differ).
  2. Laravel auto-discovers the ServiceProvider. If you're on an older Laravel or have discovery disabled, register the provider and the Skrit facade alias manually in config/app.php.
  3. Publish config: php artisan config:publish --tag=skrit-config (verify the tag in the provider's publishes() call — tags are the most common source of "nothing happened").
  4. Open src/Facades/ first. The facade docblock is the only reliable, version-pinned API reference at 1.0.0; treat any method names below as illustrative until confirmed there.

First use case: a throwaway route that round-trips a string, to confirm the codec does what you expect before wiring it into anything real.

use Skrit\Facades\Skrit;

Route::get('/skrit', function () {
    $encoded = Skrit::satrovacki('Dobar dan');   // confirm actual method name
    return ['encoded' => $encoded, 'decoded' => Skrit::desatrovacki($encoded)];
});

Look at the Livewire example second — it's the fastest way to see every codec exercised side by side, and it doubles as a manual test harness.

Implementation Patterns

Explicit codec over the auto router in application code. The unified router is great for a playground or for decoding user-submitted text of unknown provenance. In your own code paths, call the specific codec. Explicit calls are greppable, testable, and immune to detection heuristics changing under you in a patch release.

Config-driven default for user-facing features. Set the default cipher in config/skrit.php and read it from a container-bound service rather than hardcoding a codec name. This lets you flip the default per environment (e.g. a benign codec in staging, a different one in prod) without code changes.

Resolve via constructor injection in services and jobs. The facade is fine in controllers and Blade, but for anything queued or unit-tested, inject the underlying class so tests can swap a fake without touching the facade's static state:

final class ObfuscateMessage
{
    public function __construct(private readonly Skrit $skrit) {}

    public function handle(string $message): string
    {
        return $this->skrit->encode($message, config('skrit.default'));
    }
}

Round-trip as an invariant test. Whatever you build, assert decode(encode($x)) === $x in your own test suite for a corpus of realistic strings — including diacritics, mixed Latin/Cyrillic, digits, and punctuation. This is cheap and catches the lossy-codec problem in Gotchas before it reaches production.

Blade usage. If the package exposes a directive (check the ServiceProvider for Blade::directive), prefer it over {{ Skrit::... }} only for static literals; for anything dynamic, transform in the controller or a view model so the cipher never leaks into presentation logic.

Livewire integration. The bundled Livewire example is a pattern, not a dependency — copy its wire:model + computed-property structure into your own component rather than importing the example class. It demonstrates the right shape: one $input property, one $codec property, and a derived $output.

Gotchas and Tips

Multibyte is the real risk. Šatrovački-style transforms operate on syllables, and Serbian adds č ć š ž đ on top of ordinary UTF-8. If the port uses strlen/substr/array indexing internally, diacritics and any emoji will corrupt. Test with ČĆŠŽĐ specifically — not just ASCII — before trusting it on user input. If it breaks, mb_* handling is your first patch or your first issue report.

Not every codec round-trips. leetrovacki performs character substitutions (letters ↔ digits) that are inherently many-to-one. Decoding l33t text can be ambiguous or lossy. Treat leetrovacki as encode-only unless the docs explicitly promise reversibility; use šatrovački/utrovački when you need a true round trip.

Auto-router misdetection on short strings. Any heuristic that sniffs a codec needs signal. A three-word string will frequently be classified as the wrong variant. If you expose the router to users, always render the detected codec name in the UI and offer a manual override — never silently guess.

config:cache will bite you. After publishing and editing config/skrit.php, run php artisan config:clear locally. In deploy pipelines, make sure the config cache is rebuilt after the publish step, or you'll silently ship stale defaults.

Confirm the publish tag and package name. The two most common 15-minute losses on a fresh 1.0.0: wrong --tag= value, and the provider not being auto-discovered because composer.json extra.laravel.providers is missing or you're on a Laravel version outside the tested range. Read composer.json's require constraints first — the release notes don't state a supported Laravel/PHP matrix, so verify before assuming Laravel 11/12 compatibility.

100% coverage is not 100% correctness. The CI gate is a strong signal for a 1.0.0, but coverage measures lines executed, not edge cases. Treat it as "the authors care" rather than "the cipher handles your data."

Extension point. If you need a custom codec, look for an interface or abstract codec class in src/ and a registry/binding array in the config. If the package exposes a Skrit::extend()-style hook, register your codec in a service provider's boot() — not at the call site — so the auto router can also see it.

Debugging. When output looks wrong, isolate the codec from the cipher: call the codec's encode() directly on a known-good string and compare to the facade result. If they diverge, the issue is config resolution or the router, not the transform.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle