Download the PHP package hith/laravel-eraser without Composer

On this page you can find all versions of the php package hith/laravel-eraser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-eraser


Laravel Eraser

Laravel Eraser focuses on Erasing Eloquent Model Relation. It has two modes of operation.

Supported Laravel versions

Laravel Version Eraser Version
12.x 1.0+

Getting Started

Requires:

1: First, use Composer to install laravel-eraser into your project:

2: Then, publish config file:

3: Finally, Use the package in two ways:

Usage of traits:

-there are two types of traits [manual , auto]:

Manual Eraser Trait:

Then instead of:

Simply do:

Or, if you just want to clear relations without deleting the model:

Auto Eraser Trait:

As with the manual trait, simply do:

The user() relation will not be deleted in either mode, as it is considered a parent relation.

Usage of Eraser Class:

Usage of Eraser Facade:

Eraser Configuration

You can alter the behavior of the eraser either globally using the eraser config file or by defining some of this attributes on the model.

Best practices

Logging: Keep logging enabled in development/staging;

Testing: Validate deletion flows, including parent relations and many-to-many detaches, before production.

Deny list: Extend eraser_base_deny_list to match your naming patterns for utility methods.

Mode choice: Use manual mode for sensitive domains (users, orders); auto mode for convenience on simpler models.

Ownership safety: Parent relations (BelongsTo, MorphTo) are skipped to preserve ownership chains and to prevent circular deletion loops.

Pivot hygiene: Many-to-many are detached; ensure pivot constraints and cascades are correct.

Model Relationships:

In order for Eraser (auto-discover) to recognize Model relationships the following is recommended:

Log Outputs Example

Info
[info] Processing: Post[42]
[info] Processing relation 'comments'
[info] Relation 'comments' processed

Skipped
[info] Skipping parent relation 'author'
[info] Skipping already processed Post:42

Warning
[warning] Missing 'erasable' on Post
[warning] Method 'likes' did not return a Relation

Error
[error] Relation 'tags' not found on Post
[error] Error deleting relation 'images': Call to undefined method

Contributing

Thank you for considering contributing to Laravel Eraser. All the contribution guidelines are mentioned here.

License

Laravel Eraser is an open-sourced software licensed under the MIT license.


All versions of laravel-eraser with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
eventsauce/object-hydrator Version ^1.7
illuminate/support Version ^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hith/laravel-eraser contains the following files

Loading the files please wait ...