Download the PHP package rejtg21/activitylog without Composer

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

Log the activity of your users

Latest Version Build Status SensioLabsInsight Total Downloads

EOL-warning

This package has been abandoned on 2016-07-28. Please use laravel-activitylog instead.

Description

This Laravel 5 package provides a very easy to use solution to log the activities of the users of your Laravel 5 app. All the activities will be logged in a db-table. Optionally the activities can also be logged against the default Laravel Log Handler.

Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

Note:

If you're using Laravel 4, take a look at version 0.3.0 of this package.

Installation

This package can be installed through Composer.

This service provider must be registered.

You'll also need to publish and run the migration in order to create the db-table.

Activitylog also comes with a facade, which provides an easy way to call it.

Optionally you can publish the config file of this package.

The configuration will be written to . The options provided are self explanatory.

Usage

Manual logging

Logging some activity is very simple.

The string you pass to function gets written in a db-table together with a timestamp, the ip address and the user agent of the user.

Log model events

This package can log the events from your models. To do so your model must use the LogsActivity-trait and implement LogsActivityInterface.

The interface expects you to implement the getActivityDescriptionForEvent-function.

Here's an example of a possible implementation.

The result of this function will be logged, unless the result is an empty string.

Using a before handler.

If you want to disable logging under certain conditions, such as for a specific user, create a class in your application namespace that implements the Spatie\Activitylog\Handlers\BeforeHandlerInterface.

This interface defines an shouldLog($data) method in which you can code any custom logic to determine whether logging should be ignored or not. You must return true the call should be logged.

To en the namespaced class nameto the beforeHandler field in the configuration file:

For example, this callback class could look like this to disable logging a user with id of 1:

Using the after handler.

If you want to do something after the activity has been saved like for example saving also in another table, create a class that implements Spatie\Activitylog\Handlers\AfterHandlerInterface.

this interface defines a function shouldLogAfter($data) which you can create a your own function that will be triggered after saving the activity. Be sure to return the data received from parameter.

Be sure to specify the namespaced class in the configuration file

For example,

You can also add data to be passed in function specified in the interface in its second parameter it accepts array of data to carried to the function as object.

For example using afterHandler specified above,

using first the Activity::log();

it will be catch like this,

And if you want to retreive the activity, that have been inserted, in the shouldLogAfter function, you can by using $data->activity

For example,

Note: the model used in shouldLogAfter() function is the default or specified model in configuration. More info about this below.

if using Activity::log() just assign it in the variable

Using the trait in model if you want to add data to be passed in the function. It goes like this.

Use your own activity model or Extending Spatie Activity Model

If you want to specify spatie to use your own model instead of default model you can specify it in configuration file

By specifying this you informed spatie that it will use your model throughout the library. But if you only want to extend the model of spatie and add only other functions you still can, just extend the spatie model

Retrieving logged entries

All events will be logged in the activity_log-table. This package provides an Eloquent model to work with the table. You can use all the normal Eloquent methods that you know and love. Here's how you can get the last 100 activities together with the associated users.

Cleaning up the log

Over time your log will grow. To clean up the database table you can run this command:

By default records older than 2 months will be deleted. The number of months can be modified in the config-file of the package.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

About Spatie

Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

License

The MIT License (MIT). Please see License File for more information.


All versions of activitylog with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 5.*
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 rejtg21/activitylog contains the following files

Loading the files please wait ....