Download the PHP package dalisoft/userstamps without Composer

On this page you can find all versions of the php package dalisoft/userstamps. 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 userstamps

Laravel Userstamps

Latest Stable Version License Total Downloads

About

Laravel Userstamps is a Laravel package for your Eloquent Model users fields: created_by, updated_by and deleted_by. This package automatically inserts/updates an user id on your table on who created, last updated and deleted the record.

When using the Laravel SoftDeletes trait, a deleted_by colummn is also handled by this package.

Installation

This package requires Laravel 5.2 or later running on PHP 5.6 or higher.

This package can be installed using composer:

`

Configuration

Register the ServiceProvider in your config/app.php service provider list.

config/app.php `

Usage

On Migrations

Your model will need to include a created_by and updated_by column, defaulting to null. If using the Laravel SoftDeletes trait, it will also need a deleted_by column.

The column type should match the type of the ID colummn in your user's table. In Laravel <= 5.7 this defaults to unsignedInteger. For Laravel >= 5.8 this defaults to unsignedBigInteger.

You can use the Blueprint method userstamps() and add created_by, updated_by and deleted_by.

An example migration with Blueprint method:

An example migration add user stamp field:

An example migration drop auditable columns:

Attaching to Model

You can now load the trait within your model, and userstamps will automatically be maintained:

custom attributes

Optionally, should you wish to override the names of the created_by, updated_by or deleted_by columns, you can do so by setting the appropriate class constants on your model. Ensure you match these column names in your migration. You can also set the name of the display_user column that you want to return in the methods, by default it returns name.

When using this trait, helper relationships are available to let you retrieve the user who created, updated and deleted (when using the Laravel SoftDeletes trait) your model.

Methods are also available to temporarily stop the automatic maintaining of userstamps on your models:

There are also attributes available to get the name / mail / ... of the creator, editor and destroyer user in their models:

Workarounds

This package works by by hooking into Eloquent's model event listeners, and is subject to the same limitations of all such listeners.

When you make changes to models that bypass Eloquent, the event listeners won't be fired and userstamps will not be updated.

Commonly this will happen if bulk updating or deleting models, or their relations.

In this example, model relations are updated via Eloquent and userstamps will be maintained:

However in this example, model relations are bulk updated and bypass Eloquent. Userstamps will not be maintained:

As a workaroud to this issue two helper methods are available - updateWithUserstamps and deleteWithUserstamps. Their behaviour is identical to update and delete, but they ensure the updated_by and deleted_by properties are maintained on the model.

You generally won't have to use these methods, unless making bulk updates that bypass Eloquent events.

In this example, models are bulk updated and userstamps will not be maintained:

However in this example, models are bulk updated using the helper method and userstamps will be maintained:

References

This project was developed using the WILDSIDE project.

I have added new qualities to the package, such as getting the name or email of the user who created, updated and unregistered.

The functionality was also added to update the user in a parent table when creating, modifying, or deleting a record in the child table.

License

This open-source software is licensed under the MIT license.


All versions of userstamps with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
illuminate/support Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.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 dalisoft/userstamps contains the following files

Loading the files please wait ....