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
Lib Autolink

Lib Autolink Laravel Package

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.

View on GitHub
Deep Wiki
Context7

PHP HTML link formatting library

Frequently asked questions about Lib Autolink
Is iamcal/lib_autolink a Laravel package?
No. It is a framework-agnostic PHP text filter built around a single global, un-namespaced lib_autolink class with a static autolink() method. There is no service provider, facade, config file, or Blade directive anywhere in the repository. In Laravel you should contain it inside your own small wrapper class, for example App\Support\Autolink implementing link(string $text): string, so nothing else in the codebase references the library directly.
How do I install iamcal/lib_autolink in a Laravel application?
The repository has no composer.json, so composer require will not work out of the box. You need to vendor the source into your project and classmap it, or load it with require_once from a service provider. Pin the exact commit you vendor so the code you audited is the code you ship.
Does iamcal/lib_autolink work with PHP 8 and modern Laravel versions?
That is unverified. The code is PHP 5-era with a last release around June 2015, and there is no downstream evidence of it running on current runtimes. Run it on the PHP versions you actually deploy, such as 8.1 through 8.3, inside CI and watch for deprecations or removed behaviors before adopting it.
Is iamcal/lib_autolink safe against XSS?
Treat this as an output-encoding problem, because the library emits HTML. You need explicit review of how it escapes anchor text and href values, which schemes it allows, and whether javascript: or data: URLs can slip through. Add rel nofollow noopener deliberately, and consider a sanitizer such as HTMLPurifier as a backstop rather than relying on a smoke test.
How do I use iamcal/lib_autolink in a Blade template?
Build a wrapper class with a narrow method like link(string $text): string, bind it in the container, and expose it through a Blade directive such as @autolink($comment->body). Keep all policy for target, rel, and truncation in config/autolink.php so web and email rendering paths can diverge on purpose. Views should never call the library's static method directly.
Can I set rel nofollow noopener and target blank globally?
The API surface is small but does support target, rel, and truncation options. Set those once in your wrapper or configuration file instead of scattering attributes across call sites. Confirm the actual rendered output on your PHP version, since the library predates modern attribute conventions.
Does iamcal/lib_autolink skip URLs already inside HTML tags or anchor elements?
It is designed to avoid linking inside existing HTML tags and attributes, and it trims trailing punctuation and handles balanced parentheses. That covers common edge cases, but regex-based detection tends to drift from modern expectations. Test against your own content with existing anchors, query strings, and parenthesized URLs before trusting it.
What are the alternatives to iamcal/lib_autolink for Laravel?
league/commonmark's autolink extension and s9e/text-formatter are the maintained options, and both already solve escaping. The right split is Markdown through commonmark and plain-text columns through a small autolink utility, never chaining the two. Keeping your wrapper behind an interface makes a later swap a one-line binding change.
How should I test iamcal/lib_autolink in a Laravel project?
Assemble a representative corpus of thirty or so cases: short posts, long paragraphs, query strings, balanced parentheses, trailing periods, existing anchors, non-ASCII domains, and malicious payloads. Run every candidate library against the same corpus and choose on output fidelity rather than popularity. Add PHPStan or Psalm at a modest level and own your unit tests, because you cannot rely on 2015-era upstream tests.
Is iamcal/lib_autolink still maintained?
Effectively no. It has been frozen for roughly a decade with zero GitHub dependents, so assume no upstream response if you find a defect. The MIT license still makes it usable, but pin the commit, ship the license text, and keep it behind an interface so removing it stays cheap.
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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager