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

Api Platform Traits Laravel Package

l0wskilled/api-platform-traits

API Platform Traits offers reusable ORM and ODM traits for identifiers, timestamps, and soft deletes, with setup guidance for Gedmo/Stof Doctrine extensions to simplify common entity properties in API Platform projects.

View on GitHub
Deep Wiki
Context7

API Platform Traits

Package to ease the use of common properties needed for the api platform package.

You may want to have a look at: https://github.com/epubli/api-platform-test

Content of this package

  • OrmIdentificatorTrait
  • OrmTimestampableTrait
  • OrmSoftDeletableTrait
  • OdmIdentificatorTrait
  • OdmTimestampableTrait
  • OdmSoftDeletableTrait

Usage of ORM Timestampable and SoftDeletable

Add the stof doctrine extension:

composer require stof/doctrine-extensions-bundle

Edit the config file config/packages/stof_doctrine_extensions.yaml

It should look like this:

stof_doctrine_extensions:
    default_locale: en_US
    orm:
        default:
            softdeleteable: true
            timestampable: true

Here is an example class which implements these traits:

use Epubli\ApiPlatform\TraitBundle\OrmSoftDeletableTrait;
use Epubli\ApiPlatform\TraitBundle\OrmTimestampableTrait;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
 */
class Example
{
    use OrmTimestampableTrait;
    use OrmSoftDeletableTrait;
}
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.
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
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings