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

Brevity Laravel Package

kylewm/brevity

Brevity is a URL shortener for Laravel: create short links, redirect visitors, and track hits. It offers a simple, self-hosted alternative to third-party services, with configurable length and custom slugs.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Social distribution and share flows. Any roadmap item that pushes content to X/Twitter, renders share cards, or previews a post before publishing needs a "does this fit the budget?" primitive. This package supplies the trimming half of that (word-boundary-aware shortening with ellipsis) — not the counting half (platform character weighting).
  • Build vs. buy (and the answer is almost always build/vendor). This is one to two files of well-understood logic. 12 stars, 0 dependents, and no maintenance signal make it a reference implementation, not a dependency of record. CC0-1.0 means we can copy the logic into app/Support/Text/PostTruncator with zero legal review or attribution obligations — which is arguably its most valuable property. Recommended decision: port it behind an application-owned interface.
  • Consolidating preview/meta surfaces. The same truncation need recurs in OG/Twitter card descriptions, email preheaders, push notification bodies, SMS (~140), admin list views, and validation messaging. If we standardize, we standardize on one internal helper and one behavior spec — this package is a candidate for that spec's behavior, not its long-term implementation.
  • Scope discipline on "accurate tweet length." A PM must explicitly choose between approximate truncation (fine for previews, OG tags, admin views) and exact X-aware counting (URLs counted as 23 chars, CJK ≈ 2 weighting, emoji codepoints). This package plausibly covers the former only. A hard 280-character publishing gate needs the latter — that's a separate, larger build decision. Getting this wrong produces a "your post is too long" bug that only appears with links and emoji.
  • Opportunity framing. Adopting this unblocks no feature on its own; it marginally reduces effort on a small one. The low scores (0.06 overall, 34.4 opportunity) are accurate: it is a leaf utility with near-zero switching cost, so it should never appear as a roadmap dependency or a risk to a delivery date.
  • Documentation credibility flag. The package blurb markets it as a Laravel short-link generator with service providers and drivers; the source is a framework-agnostic text truncator with none of that. Decision implication: do not plan against the README. Anything we commit to must be based on reading src/.

When to Consider This Package

Consider it when:

  • You need plain, word-boundary-aware truncation of short plain-text strings — captions, titles, excerpts, notification bodies — and nothing more.
  • The output is cosmetic or displayed to a human: previews, cards, OG meta, admin tables. Nothing is persisted, and nothing is enforced against an external API's hard limit.
  • The team accepts a leaf utility with no maintainer, provided it is pinned or, preferably, vendored/ported.
  • License friction matters: CC0-1.0 removes legal review, which makes "copy the two files" a cheaper path than dependency management.
  • You can supply the surrounding engineering discipline: mbstring present, PHP version verified against the target Laravel runtime, an internal interface in front of it, and contract tests for Unicode, emoji, combining characters, URLs, mentions, hashtags, and HTML-stripped input.

Look elsewhere (or budget a real build) when:

  • You are enforcing a hard platform limit for publishing. X counts every URL as 23 characters regardless of length and weights CJK; this algorithm counts actual characters. Discrepancy here means rejected posts or truncated links.
  • The input is HTML or rich text. The library assumes plain text and will silently chop inside tags. You must strip or render first, and own that in your wrapper.
  • The product is multilingual or emoji-heavy at scale. Treat output as an upper bound, not an exact count.
  • You need configurable behavior — different ellipsis, URL weighting, trailing-punctuation stripping. There are no hooks, formatters, or config; all customization is post-processing you write and own.
  • You require a maintained, supported, security-responsive dependency, or the surface sits on a payment, compliance, or otherwise regulated path.
  • Output is persisted and later corrected. Silent wrong truncation means user-visible defects and possible data cleanup — a poor trade for a 40-line helper.

How to Pitch It (Stakeholders)

For executives (30 seconds): This is a small, free (CC0-licensed) utility for trimming text to fit character limits — relevant to sharing, previews, and notification surfaces. It is not strategic and nothing on the roadmap depends on it. Recommended action: port the logic into our codebase rather than taking it as a dependency. Cost is roughly a day including tests; there is no vendor lock-in, no licensing exposure, and no adoption risk because we own the copy. The one decision I need is whether we are committing to approximate truncation (previews) or exact platform-aware character counting (publishing) — the latter is a separate, larger piece of work.

For engineering (the ask):

  • Treat it as a reference implementation of the Known/Clearbit brevity algorithm, not a library to depend on: no service provider, no config, no facade, no tests worth trusting, no PHP 8 guarantees.
  • Wrap it: define an internal PostTruncator contract with explicit length, URL, and ellipsis semantics; keep the vendor call or the ported copy as an implementation detail. No controllers, models, jobs, or Blade templates should reference it directly.
  • Sequence: short spike against real content (Unicode, emoji, URLs, mentions, hashtags, HTML) → port into app/Support/ → contract tests on expected output → integrate first in a low-risk path (previews, admin tooling) → compare against current Str::limit/substr behavior → expand to publishing paths only after validation.
  • Non-negotiables: strip_tags() before shortening; a final hard Str::limit() belt-and-braces check before any API call; log input/output lengths when debugging; never shorten an already-shortened string without expecting a double ellipsis.
  • Risk statement: the failure mode is not downtime — it is silent, user-visible incorrect output. That is acceptable for previews and unacceptable for anything persisted or enforced, which is exactly why it stays behind an interface we control.
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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager