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

Safe Laravel Package

nette/safe

nette/safe is a lightweight Nette library providing exception-throwing wrappers for risky PHP functions, helping Laravel and PHP projects fail loudly instead of silently returning false. It offers safer file, stream, and process helpers for more reliable error handling.

View on GitHub
Deep Wiki
Context7

🛡 PHP functions rewritten to throw exceptions instead of returning false or triggering errors.

Frequently asked questions about Safe
Is nette/safe compatible with Laravel?
It can be autoloaded in a Laravel application, but nette/safe has no Laravel service provider, facade, config, or container binding. It is a framework-agnostic PHP utility that wraps native functions, so it contributes no Laravel-idiomatic integration. Laravel already favors exception-first error handling, making the package largely redundant. It is also explicitly marked discontinued, so it is not a good fit for new Laravel work.
Is nette/safe still maintained?
No. The package is explicitly marked DISCONTINUED and its repository is archived. That means no bug fixes, no PHP-version compatibility updates, no security patches, and no maintainer response to issues. Treat it as abandoned code rather than an actively supported dependency.
How do I install nette/safe with Composer?
Installation would be a straightforward composer require nette/safe. Its function-override mechanism only affects unqualified calls made from namespaced code that imports the affected functions, so it does not globally rewrite PHP behavior. For a new Laravel project, however, greenfield adoption is not recommended because the package is discontinued. If you must inspect it, use it as a reference pattern rather than a runtime dependency.
What does nette/safe do?
nette/safe provides exception-throwing wrappers for risky PHP functions that normally return false or trigger warnings. It includes safer file, stream, and process helpers intended to make failures loud instead of silent. The library operates at the language-runtime layer through namespaced function overrides resolved by Composer autoloading. It is a small Nette utility, not a Laravel package.
Which PHP versions does nette/safe support?
The provided context does not state a specific supported PHP range, and the repository is archived with no maintainer updates. With no upstream maintenance, compatibility with current or future PHP 8.x releases is not guaranteed. You would need to inspect its Composer constraints and test it yourself, but that burden remains yours permanently. Pinning it for the life of an application is a significant risk.
Can I use nette/safe in production?
Production use carries high technical and compliance risk. The package is abandoned, has very low adoption at roughly 16 stars, and is reported with a NOASSERTION license that may not survive legal review. It also changes error semantics, which can produce subtle, hard-to-trace regressions. For commercial Laravel applications, native PHP 8 strictness and Laravel-native exceptions are safer choices.
What license does nette/safe use?
The license is reported as NOASSERTION, meaning the actual licensing terms could not be confidently identified. That is a material compliance risk for commercial distribution and should be reviewed by legal before any use. Because the project is archived, clarifying or updating the license upstream is unlikely. Avoid adopting it until licensing is resolved.
How do I remove nette/safe from an existing Laravel app?
Identify all use function Nette\Safe\... imports and the call sites that depend on them. Inline equivalent guards, explicit checks, or custom domain exceptions, then delete the Composer dependency. The removal is generally low-risk because the package is small and its call surface is enumerable through static analysis. Plan the migration incrementally and test the affected paths.
What are the best alternatives to nette/safe in Laravel?
Use native PHP 8 features such as strict error handling, JsonException, and PDOException defaults, plus explicit checks for functions that return false. Laravel provides exception-first constructs like custom exceptions, rescue(), throw_if, throw_unless, form requests, and typed return values. These cover the same goal of failing loudly without adding an abandoned dependency. There is no need for a first-class replacement package for most Laravel codebases.
Does nette/safe work with Laravel's exception handler and logging?
No, it does not integrate with Laravel's exception handler, validation pipeline, or logging stack. Any exceptions it throws are standard PHP exceptions that Laravel may catch if they bubble up, but there is no package-specific handler, facade, or config. The library has no service provider or container binding. If you need Laravel-aware reporting, implement it with Laravel's own exception handling.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
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