PHPackages                             fly-crud/fly-crud - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. fly-crud/fly-crud

ActiveLibrary[File &amp; Storage](/categories/file-storage)

fly-crud/fly-crud
=================

Simple crud system build on top of flysystem

v3.0.0(7y ago)1227.6k↑45.8%41MITPHPPHP &gt;=7.1

Since May 5Pushed 7y ago3 watchersCompare

[ Source](https://github.com/oscarotero/fly-crud)[ Packagist](https://packagist.org/packages/fly-crud/fly-crud)[ Docs](https://github.com/oscarotero/fly-crud)[ RSS](/packages/fly-crud-fly-crud/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (3)Versions (8)Used By (1)

fly-crud
========

[](#fly-crud)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e5af52609d24f188840292ca0a715e6e86a76f23773eed07c998eb08e4de53c5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f736361726f7465726f2f666c792d637275642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/oscarotero/fly-crud/?branch=master)[![Build Status](https://camo.githubusercontent.com/b1feb418690b8aea5513c862ec61bb117959011ea704c85f1ae6cab52b1efcef/68747470733a2f2f7472617669732d63692e6f72672f6f736361726f7465726f2f666c792d637275642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/oscarotero/fly-crud)

Sometimes you don't need a database, just some data in yaml/json/etc files to build a website.

This library provides a simple way to manage data stored in files using [flysystem](http://flysystem.thephpleague.com/) as engine.

Installation
------------

[](#installation)

The library is compatible with PHP &gt;= 7.1 and installable and autoloadable via Composer as [fly-crud/fly-crud](https://packagist.org/packages/fly-crud/fly-crud).

```
$ composer require fly-crud/fly-crud

```

Usage example:
--------------

[](#usage-example)

```
use FlyCrud\Directory;
use FlyCrud\Formats\Json;

//Create a repository to store the data as json
$repo = Directory::make('/path/to/files', new Json());

//Create a new document
$document = new Document([
    'title' => 'Title post',
    'intro' => 'This is the new post'
]);

//Get/set/edit data
$document->title = 'The new title post';

//Save the document
$repo->saveDocument('first-post', $document);

//Get the document again
$document = $repo->getDocument('first-post');

//or delete it
$repo->deleteDocument('first-post');
```

Working with directories
------------------------

[](#working-with-directories)

Let's say we have the following structure with yaml files:

```
_ site
  |_ posts
    |_ first-post.yml
    |_ second-post.yml
  |_ articles
    |_ first-article.yml
    |_ second-article.yml
    |_ third-article.yml

```

```
use FlyCrud\Directory;
use FlyCrud\Document;
use FlyCrud\Formats\Yaml;

//Create a repository pointing to our site data using Yaml format:
$site = Directory::make(__DIR__.'/site', new Yaml());

//Get the posts directory
$posts = $site->getDirectory('posts');

//And the first post document
$post = $posts->getDocument('first-post');

//Or store a new document
$posts->saveDocument('third-post', new Document([
    'title' => 'My awesome third post',
    'intro' => 'This is the third post'
]));
```

Array access and property access
--------------------------------

[](#array-access-and-property-access)

To ease the work with documents and directories:

- Use properties to access to directories (ex: `$site->posts`)
- Use array-like syntax to access to documents (ex: `$posts['first-post']`)

Example with the same structure used previously:

```
//Access to the first-article document
$article = $site->articles['first-article'];

//Save a new article
$site->articles['other-article'] = new Document([
    'title' => 'I like tomatoes'
    'intro' => 'Yes, they are red, rounded and tasty!'
]);
```

API
---

[](#api)

MethodDescription`Directory::getDocument($id)`Returns a document instance`Directory::hasDocument($id)`Check if a document exists`Directory::saveDocument($id, $document)`Saves a document in the directory. Override it if it does not exists`Directory::deleteDocument($id)`Removes a document in the directory`Directory::getAllDocuments()`Returns an array with all documents`Directory::getDirectory($id)`Returns an instance with a subdirectory`Directory::hasDirectory($id)`Check if a subdirectory exists`Directory::createDirectory($id)`Creates a new directory and return it`Directory::deleteDirectory($id)`Removes a directory in the directory`Directory::getAllDirectories()`Returns an array with all directoriesWorking with documents
----------------------

[](#working-with-documents)

Documents are clases extending [ArrayObject](http://php.net/manual/en/class.arrayobject.php) with some additions:

- Implements the [JsonSerializable](http://php.net/manual/en/class.jsonserializable.php) interface, so you can convert the document to json easily `json_encode($document)`
- Implements the magic methods `__get()`, `__set()`, `__isset()` and `__unset()`, so you can manipulate the values like properties.
- The data is converted to `stdClass` objects, this allows to manipulate it easily. Example:

```
use FlyCrud\Document;

//Create a document
$post = new Document([
    'title' => 'My post',
    'tags' => ['php', 'code'],
    'sections' => [
        [
            'title' => 'Section one',
            'body' => 'This is the first section of the document'
        ],[
            'title' => 'Section two',
            'body' => 'This is the second section of the document'
        ]
    ]
]);

//Use the properties to access to the data:
echo $post->title; // "My post"
echo $post->tags[0]; // "php"
echo $post->sections[0]->title; // "Section one"

//Modify the data
$post->section[1]->title = 'New title of the second section';
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~165 days

Recently: every ~227 days

Total

7

Last Release

2671d ago

Major Versions

v1.0 → v2.0.02016-07-30

v2.0.3 → v3.0.02019-01-24

PHP version history (2 changes)1.x-devPHP &gt;=5.5.0

v3.0.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/e99df56b617f4af8cf0556a51a0ca20c7420104920c57d7e9eab093f92bb744f?d=identicon)[oscarotero](/maintainers/oscarotero)

---

Top Contributors

[![oscarotero](https://avatars.githubusercontent.com/u/377873?v=4)](https://github.com/oscarotero "oscarotero (24 commits)")

---

Tags

crudflysystemjsonFlysystemyamlcrud

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fly-crud-fly-crud/health.svg)

```
[![Health](https://phpackages.com/badges/fly-crud-fly-crud/health.svg)](https://phpackages.com/packages/fly-crud-fly-crud)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)[league/flysystem-local

Local filesystem adapter for Flysystem.

225231.8M39](/packages/league-flysystem-local)[oneup/flysystem-bundle

Integrates Flysystem filesystem abstraction library to your Symfony project.

64422.9M66](/packages/oneup-flysystem-bundle)[league/flysystem-bundle

Symfony bundle integrating Flysystem into Symfony applications

40129.5M87](/packages/league-flysystem-bundle)[league/flysystem-sftp-v3

SFTP filesystem adapter for Flysystem.

6129.6M91](/packages/league-flysystem-sftp-v3)[spatie/flysystem-dropbox

Flysystem Adapter for the Dropbox v2 API

3644.6M68](/packages/spatie-flysystem-dropbox)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
