Weave Code
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
Laravel Paper

Laravel Paper Laravel Package

jacobjoergensen/laravel-paper

Laravel Paper adds flat-file drivers to Eloquent for Laravel 12+ (PHP 8.4+). Point a model to a content directory and query Markdown or JSON files with familiar Eloquent APIs—no database, schema, or custom connection. Uses attributes + a trait.

View on GitHub
Deep Wiki
Context7

A flat-file Eloquent driver for modern Laravel.

Frequently asked questions about Laravel Paper
Can I use Laravel Paper for a production blog with 5,000+ posts?
Laravel Paper works for production, but performance may degrade with large datasets due to file I/O. For 5,000+ posts, consider caching results (e.g., Redis) or splitting content into subdirectories by year/month. Test read/write speeds under load before scaling.
How do I migrate from SQL to flat files with Laravel Paper?
Export your SQL data to JSON/Markdown files using Laravel’s query builder or a custom script, then update your models to use the `#[Driver]` and `#[ContentPath]` attributes. Test thoroughly, as relationships and constraints won’t auto-migrate. Use a staging environment for validation.
Does Laravel Paper support relationships between models (e.g., Post hasMany Comments)?
Yes, but relationships require both models to use Laravel Paper. Define relationships normally (e.g., `hasMany(Comment::class)`), but ensure the foreign key (e.g., `post_id`) maps to the slug of the parent file. Complex relationships may need custom logic for file-based lookups.
Will Laravel Paper work with Laravel Vapor or multi-server deployments?
Laravel Paper relies on shared filesystem access (e.g., S3, EFS). For multi-server setups, ensure all instances use the same storage backend and handle file locking manually if concurrent writes are possible. Avoid local filesystems in distributed environments.
How do I handle concurrent edits to the same Markdown/JSON file?
Laravel Paper lacks built-in file locking, so concurrent edits risk overwriting changes. Mitigate this by implementing optimistic locking (e.g., a `last_updated_at` timestamp) or using a queue system to serialize writes. For critical data, consider SQL or a dedicated CMS.
Can I use Laravel Paper with Laravel Scout for full-text search?
No, but you can integrate external search tools like Algolia or Meilisearch by indexing the file contents separately. Laravel Paper provides the raw data; you’d need to sync changes to your search provider via model observers or events.
What’s the best way to back up content stored in flat files?
Back up the entire content directory (e.g., `content/posts`) using your existing filesystem backup strategy. For cloud storage (S3), use versioning or lifecycle policies. Test restores by copying files to a staging environment and verifying Eloquent queries work as expected.
Does Laravel Paper support soft deletes or model events like `saved` or `deleted`?
Yes, Laravel Paper supports Eloquent events (e.g., `saved`, `deleted`) and soft deletes via the `use SoftDeletes` trait. Soft deletes work by adding a `deleted_at` field to your Markdown/JSON files. Events trigger normally, but file operations may need error handling for edge cases.
How do I secure sensitive data stored in JSON/Markdown files?
Avoid storing sensitive data in flat files entirely. If you must, restrict file permissions (e.g., `storage:link --relative` with `chmod 600`) and encrypt files at rest using Laravel’s encryption services. Never expose these files publicly via web routes.
What alternatives exist if I need flat-file storage but Laravel Paper lacks a feature?
Alternatives include Spatie’s `laravel-medialibrary` (for file-based assets), `spatie/array-to-xml` (for XML support), or custom drivers using Laravel’s `DatabaseManager`. For CMS-like workflows, consider Statamic or October CMS. If you need SQL-like features, evaluate SQLite or a lightweight database like Redis.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky