Download the PHP package nti/audit-bundle without Composer

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

Audit bundle

This bundle creates an audit log for all doctrine ORM database related changes:

Basically you can track any change from these log entries if they were managed through standard ORM operations.

NOTE: audit cannot track DQL or direct SQL updates or delete statement executions.

Pre-Install

To continue using Query Loggers methods within the audit log bundle, Symfony versions up to 6.x require the installation of firehed/dbal-logger v1.0.1. Make sure to have this installed before proceeding to the next step.

Install

First, install it with composer:

composer require nti/audit-bundle

Then, add it in your AppKernel bundles.

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        ...
        new DataDog\AuditBundle\DataDogAuditBundle(),
        ...
    );
    ...
}

Using Query:

//SQL
CREATE TABLE audit_logs (id INT AUTO_INCREMENT NOT NULL, source_id INT NOT NULL, target_id INT DEFAULT NULL, blame_id INT DEFAULT NULL, action VARCHAR(12) NOT NULL, tbl VARCHAR(128) NOT NULL, diff LONGTEXT DEFAULT NULL COMMENT'(DC2Type:json_array)', logged_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_D62F2858953C1C61 (source_id), UNIQUE INDEX UNIQ_D62F2858158E0B66 (target_id), UNIQUE INDEX UNIQ_D62F28588C082A2E (blame_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB;
CREATE TABLE audit_associations (id INT AUTO_INCREMENT NOT NULL, typ VARCHAR(128) NOT NULL, tbl VARCHAR(128) DEFAULT NULL, label VARCHAR(255) DEFAULT NULL, fk VARCHAR(255) NOT NULL, class VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB;
CREATE TABLE audit_request (id INT AUTO_INCREMENT NOT NULL, method VARCHAR(255) DEFAULT NULL, controller VARCHAR(255) DEFAULT NULL, route VARCHAR(255) DEFAULT NULL, route_params LONGTEXT DEFAULT NULL, ip VARCHAR(255) DEFAULT NULL, user_name VARCHAR(255) DEFAULT NULL,portal VARCHAR(255) DEFAULT NULL, query_data LONGTEXT DEFAULT NULL, data LONGTEXT DEFAULT NULL, created_on DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB;     ALTER TABLE audit_logs ADD CONSTRAINT FK_D62F2858953C1C61 FOREIGN KEY (source_id) REFERENCES audit_associations (id);
ALTER TABLE audit_logs ADD CONSTRAINT FK_D62F2858158E0B66 FOREIGN KEY (target_id) REFERENCES audit_associations (id);
ALTER TABLE audit_logs ADD CONSTRAINT FK_D62F28588C082A2E FOREIGN KEY (blame_id) REFERENCES audit_associations(id);
ALTER TABLE audit_associations ADD created_on DATETIME NOT NULL;

Using Doctrine Schema:

// Doctrine
php bin/console doctrine:schema:update -f

Config

Enable the audit request in the project:

// app/config.yml
# DataDog
data_dog_audit:
    audit_request:
        enabled: true

If you will use a custom database connection use following config:

// app/config.yml
# DataDog
data_dog_audit:
    database:
        connection_name: nti_logs    
    audit_request:
        enabled: true

See How to Work with multiple Entity Managers and Connections

Annotations

Annotations has to use in the controller, add Annotations NTIAudit in the class:

//src/Bundle/Controller/Controller.php
use DataDog\AuditBundle\Annotations\NTIAudit;

/**
* Class Controller
* @package AppBundle\Controller
* @NTIAudit()
* @Route("/controller")
*/
class Controller extends Controller {
    //TODO CODE HERE
}

Unaudited Entities

Sometimes, you might not want to create audit log entries for particular entities. You can achieve this by listing those entities under the unaudited_entities configuration key in your config.yml, for example:

data_dog_audit:
    unaudited_entities:
        - AppBundle\Entity\NoAuditForThis

Specify Audited Entities

Sometimes, it is also possible, that you want to create audit log entries only for particular entities. You can achieve it quite similar to unaudited entities. You can list them under the audited_entities configuration key in your config.yml, for example:

data_dog_audit:
    audited_entities:
        - AppBundle\Entity\AuditForThis

You can specify either audited or unaudited entities. If both are specified, only audited entities would be taken into account.

Command

For delete audit data:

php bin/console nti:audit:delete {qtyDays}

License

NTI


All versions of audit-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
symfony/framework-bundle Version ^2.6|^3.0|^4.0|^4.4|^5.4|^6.4
doctrine/orm Version ^2.4|^3.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 nti/audit-bundle contains the following files

Loading the files please wait ....