Download the PHP package sinclairt/track without Composer

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

Installation

composer require sinclairt/track

Next you need to register the service provider in app/config/app.php:

Finally run php artisan vendor:publish

Usage

All you need to do is use the TrackTrait in any model which extends Eloquent that you want tracking.

Note if you include the TrackTrait before running the migrations and seed the database for example the package will fail as the table does not exist to insert data into.

The following events are tracked automatically: Created, Updating, Updated, Deleted, and Restored (This is only tracked when the SoftDeleteTrait is also in use by the model).

This package can track pivot table sync, but an event is not fired inside Laravel so you must implement this manually. This method will only work after calling sync().

After calling this method return the results into the method trackPivotChanges() along with the current model and the other fully qualified related model name.

Example:

It is not necessary to use a fully qualified class name however if you want to use the built in presenter then you will, otherwise you can create your own implementation.

Custom Logging

You can log anything on an object by calling:

The event is the type of event you are logging, this is where the Track package stores Created/Updated/Deleted etc events. The model will default to the current object if not passed but it is possible to over ride this. The $data variable contains all the additional fields you wish to store against the track, they can be :

Log Events

Add any event class to the events key inside the track config, and the track package will log the event, it will not attach it to any object, but it will be available via the Track model directly.

There is currently a custom example event, you can remove that (or keep if you fancy).

API

There are 4 routes into the package:

API Paginated Calls

You can set the following parameters for paginated calls:

Presenting

To get the changes of particular object call the method trackedChanges() on your tracked object.

The Track model has a view presenter configured for your benefit.

Example:

The following text will be returned:

The presenter uses the Auth User model by default but you can change this in the config file.

The field name used for display is also listed here with username being the default. Equally, when the Presenter is called and it names the attached/detached object it is using the field name of "name" by default. There is no configuration for this as it could be different for each class, in this circumstance you can use the Presenter as a template and create your own, or ensure your tables that have pivots have a name field on them.


All versions of track with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
laracasts/presenter Version ^0.2.1
sinclairt/api-foundation Version ^1.0.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 sinclairt/track contains the following files

Loading the files please wait ....