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

File Util Laravel Package

rosell-dk/file-util

A small PHP utility library providing convenient helpers for working with files: checking existence, reading and writing contents, and retrieving sizes, extensions and MIME types through a clean, testable API.

Deep Wiki
Context7

Misc utilities for dealing with files and paths

Frequently asked questions about File Util
What is rosell-dk/file-util used for?
rosell-dk/file-util is a small PHP utility library for common file and path tasks. It provides helpers for checking file existence, reading and writing contents, and retrieving sizes, extensions, and MIME types. It is framework-agnostic, so you can use it inside Laravel applications when you want a simple testable API instead of scattering native file functions.
How do I install rosell-dk/file-util in a Laravel project?
Install it with Composer using composer require rosell-dk/file-util. Because it is a PHP package rather than a Laravel package, no service provider or configuration is required. You can then instantiate its utility classes or call its helpers directly in your application code.
Is rosell-dk/file-util framework-agnostic or Laravel-specific?
It is framework-agnostic PHP, not a Laravel-specific package. That means it does not depend on Laravel facades, service providers, or configuration. You can use it in Laravel, in other frameworks, or in plain PHP projects.
How do I check if a file exists with rosell-dk/file-util?
Use the library's existence-checking helper, which wraps the usual filesystem check in a clean API. This keeps file checks consistent and easier to test than calling native functions directly. In Laravel, call it from a service, job, or controller where you need to verify a path before reading or writing.
Can rosell-dk/file-util read and write file contents?
Yes, the package includes helpers for reading and writing file contents. These methods let you handle common file operations through a consistent, testable interface. For large files or streaming needs, evaluate whether native streams or Laravel's Storage facade better fit your use case.
How do I get a file's extension or MIME type with this package?
The library provides helpers for retrieving file extensions and MIME types. This is useful for validation, upload handling, or routing logic based on file type. Keep in mind that MIME detection behavior depends on the underlying PHP filesystem functions and available extensions.
Can I retrieve file sizes with rosell-dk/file-util?
Yes, rosell-dk/file-util includes helpers for retrieving file sizes. You can use this for display, validation, or quota checks without writing repeated filesize calls. For remote files or Laravel storage disks, use the appropriate Laravel or filesystem API instead.
Is rosell-dk/file-util suitable for production Laravel applications?
It is a small utility library suitable for production use when you need straightforward file helpers. Review the package source and version constraints as part of your normal dependency audit. For critical upload or storage workflows, combine it with Laravel validation and proper error handling.
How do I test code that uses rosell-dk/file-util?
Because the package exposes a clean API, you can isolate file operations behind small wrappers or services and test those with temporary directories. Use PHPUnit or Pest to create and clean up fixture files in a temporary path. Avoid hard-coding production paths in tests, and assert both success and failure cases.
What are alternatives to rosell-dk/file-util for file handling in Laravel?
Alternatives include Laravel's File and Storage facades, Symfony Filesystem, and native PHP file functions. Laravel's Storage facade is often the better choice for disks, cloud storage, and framework-integrated workflows. Choose rosell-dk/file-util when you want a lightweight, framework-agnostic helper set for basic local file tasks.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
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