PHPackages                             simple-crud/extra-fields - 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. [Database &amp; ORM](/categories/database)
4. /
5. simple-crud/extra-fields

ActiveLibrary[Database &amp; ORM](/categories/database)

simple-crud/extra-fields
========================

Extra fields for simple-crud package

v2.0.0(6y ago)2834MITPHPPHP &gt;=7.2

Since Apr 14Pushed 6y ago1 watchersCompare

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

READMEChangelog (5)Dependencies (6)Versions (6)Used By (0)

SimpleCrud Fields
=================

[](#simplecrud-fields)

Package with extra fields for [simple-crud](https://github.com/oscarotero/simple-crud)

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

[](#installation)

This package is installable and autoloadable via Composer as [simple-crud/extra-fields](https://packagist.org/packages/simple-crud/extra-fields).

```
$ composer require simple-crud/extra-fields

```

### File

[](#file)

Used to upload files into a directory and save the file name in the database. Detects instances of `Psr\Http\Message\UploadedFileInterface` [see here PSR-7 standard](http://www.php-fig.org/psr/psr-7/).

- First, you must define the uploads path used by the database, using the attribute `SimpleCrud::ATTR_UPLOADS`
- On register the field, the `File` format will be asigned to any field named "file" or ending by "File" (for example: imageFile, avatarFile, etc)
- By default, the file is saved in a subdirectory named as `[table]/[field]`. For example, the images of the field `avatar` of the table `user` will be saved in the folder `uploads/user/avatar`.
- The filename is slugified and converted to lowercase. For example, the file `My Picture.JPG` is renamed to `my-picture.jpg`.

```
use SimpleCrud\Fields\File;

//Register the field
File::register($simpleCrud);

//Configure the directory to upload the files
$simpleCrud->setConfig(File::CONFIG_UPLOADS_PATH, '/path/to/uploads');

//You can also configure the File field
$simpleCrud->user->file
	->setConfig('directory', '/path/to/uploads') //custom directory used instead the default File::DIRECTORY
	->setConfig('relative_directory', '/images') //custom subdirectory (by default is /{table_name}/{field_name})
	->setConfig('save_relative_directory', true) //whether save the relative_directory in the database instead only the filename (false by default)

//Get the data from the serverRequest
$data = $request->getParsedBody();
$files = $request->getUploadedFiles();

//Create the new user
$user = $simpleCrud->user->create([
    'name' => $data['name'],
    'email' => $data['email'],
    'file' => $files['avatar'],
]);

//Save the data
$user->save();

//Get the avatar file
echo $user->file; // /user/avatar/image.jpg;
```

### Slug

[](#slug)

Used to save slugified values using [cocur/slugify](https://github.com/cocur/slugify). On register the field, the `Slug` format will be asigned to any field named "slug"

```
use SimpleCrud\Fields\Slug;

//Register the field
Slug::register($simpleCrud);

//Create the new article
$title = 'Hello world'
$article = $simpleCrud->articles->create([
    'title' => $title,
    'slug' => $title,
]);

//Save the data
$article->save();

//Get the slug
echo $user->article->slug // hello-world
```

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

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 ~215 days

Total

5

Last Release

2450d ago

Major Versions

v0.1.3 → v2.0.02019-08-24

PHP version history (2 changes)v0.1.0PHP &gt;=5.4

v2.0.0PHP &gt;=7.2

### 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 (11 commits)")

---

Tags

mysqlsqliteformats

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/simple-crud-extra-fields/health.svg)

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

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[catfan/medoo

The lightweight PHP database framework to accelerate development

4.9k1.5M193](/packages/catfan-medoo)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M35](/packages/scienta-doctrine-json-functions)[nette/database

💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

5656.7M231](/packages/nette-database)[cycle/orm

PHP DataMapper ORM and Data Modelling Engine

1.3k835.4k64](/packages/cycle-orm)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)

PHPackages © 2026

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