iamcal/lib_autolink
iamcal/lib_autolink is a lightweight PHP library that automatically converts plain-text URLs and email addresses into HTML anchor tags. It provides a simple API for autolinking user-generated content such as comments, messages, and forum posts.
composer.json, and no release since June 2015, adoption is really a make decision dressed as a buy: the PM should treat it as an in-house utility built around a ~200-line reference implementation, or as a comparison candidate in a spike.league/commonmark with its Autolink extension, or s9e/text-formatter) if requirements will grow. "Just add the package" is not on the menu — there is nothing to composer require.http/https only), whether links open in a new tab, whether rel="nofollow noopener" is mandatory, the order of escaping vs. linkifying (escape first, always), and whether autolinking user-generated text is acceptable on this surface at all. It also forces a call on double-linking and inputs that already contain markup.Consider it when:
App\Support\Autolink) behind a narrow interface such as link(string $text): string, bind it in the container, expose it via a Blade directive, and let nothing else in the app touch the library directly.<a> tags, javascript:/data: payloads, very long inputs) and pick the winner on output fidelity and escaping behavior — not on stars.Look elsewhere or build in-house when:
href attributes or dangerous schemes is a live threat — autolinking is an output-encoding problem, and this library emits HTML with no documented escaping policy.composer.json in the repo, so a path repository won't work; you must classmap or require_once it. If that governance overhead isn't worth a utility this small, an in-house helper is cheaper.preg_* backtracking limits could silently blank content; you can't tolerate PHP 8 deprecation noise under strict error handling; or you'd be making it a platform-level dependency.Default recommendation: evaluate a maintained alternative first; adopt this only if a side-by-side spike shows its output is demonstrably better, and then only behind the abstraction and a feature flag.
To executives: This is a tiny MIT-licensed PHP utility that makes URLs clickable in plain text — a cheap usability win for comments, tickets, and notification emails, achievable in roughly a day of engineering. The catch is that it is essentially orphaned code from 2015 with no maintainer, so we should treat it as a tactical convenience, not a strategic dependency. Recommendation: approve a short spike, adopt only for narrow low-risk surfaces behind a wrapper, and budget a small recurring cost to own it (or use a maintained library if requirements grow). Do not let it become the only protection for user-generated content.
To engineering: Plain PHP, no Laravel integration — no service provider, facade, config, or Blade support. It's a single file declaring a global un-namespaced class, so vendor it via classmap or require_once, not composer require. Wrap it once in App\Support\Autolink, escape the input first (e($text)) so surrounding text can never emit raw HTML, then linkify; allowlist http/https only, force rel="nofollow noopener" (and target only where appropriate — not in email templates), put policy in config/autolink.php, and degrade to plain escaped text on any failure rather than throwing. Add your own tests for XSS, trailing punctuation, Unicode/IDN, nested anchors, and PHP 8 behavior; benchmark bulk backfills and cap input length. Known failure modes: XSS via unescaped attributes or javascript:/data: schemes (highest severity), silent content loss when regex limits are hit, broken/truncated links from edge-case parsing, and double-linking on input that already contains markup.
To the team / decision record: Name an owner, pin the exact version and commit hash (fork or vendor if resolution is unreliable), roll out behind a feature flag to one low-risk surface such as comments, and set a review date tied to each PHP upgrade cycle. Document the decision to accept an unmaintained dependency, and record the substitution path — because the wrapper is a one-line binding change, swapping to league/commonmark's Autolink extension or s9e/text-formatter later is cheap, provided we build the interface first and choose on corpus results rather than on stars.
How can I help you explore Laravel packages today?