Library to perform CRUD operations on entities.

Maintainers

Details

codeberg.org/scripthoodie/crud/

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

pkg:composer/scripthoodie/crud

0.2.0 2026-01-03 19:45 UTC

This package is not auto-updated.

Last update: 2026-01-04 18:20:56 UTC


README

Library to perform CRUD operations on entities.

Install

Via Composer

$ composer require scripthoodie/crud

Usage

The below example uses entity and factories defined in the tests/ directory.

<?php

use ScriptHoodie\Crud\Core\Crud;
use ScriptHoodie\Crud\Core\Product;
use ScriptHoodie\Crud\Core\EveryThing;
use ScriptHoodie\Crud\Core\CrudWrapper;
use ScriptHoodie\Crud\Core\Factories\SimpleEntityFactory;

require __DIR__ . '/vendor/autoload.php';

$everything = new EveryThing();
$entityFactory = new SimpleEntityFactory(Product::class);
$crud = new Crud(
    $entityFactory,
    $everything,
    $everything,
    $everything,
    $everything,
);
$crud = new CrudWrapper($crud, ['user' => '101']);

$id = $crud->create(['name' => 'Turbo encabulator']);

$entity = $crud->read($id);

var_dump($entity);