Download the PHP package minvws/audit-logger without Composer

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

PHP Audit Logger (nl-rdo-audit-logger)

This package provides a generic logging service for the RDO platform. It allows to easily log events to the database, syslog or other destinations.

Log events can be logged with or without PII data. PII data is data that can be used to identify a person. Depending on the logging destination, it can send the PII data or not.

Data can be automatically encrypted with a public/private keypair so that logging can be written, but not directly read.

This package is a generic module that isn't directly coupled to a framework, however, there are other packages that provide a framework specific implementation.

Installation

Requirements

Composer

You can install the package via the composer package manager:

Configuration

PSR logging

With the PSRLogger you can log through any PSR compatible logger. This makes it easy to log to any destination like syslog, or monolog.

Encryption

Audit lines can optionally be encrypted so they can only be read by the application that has the private key.

To generate a new keypair, use the following code:

Logging full request

The option log_full_request can be used to log the full HTTP request. Any sensitive information like passwords, tokens etc should be stripped from the request. However, there is no guarantee that all sensitive information will be stripped if the naming is different.

However, this configuration option is NOT implemented. You MUST call logFullRequest() on the event in order to log the full request.

Usage

To use the logger, inject or resolve the LogService class. This class has a single method:

To create an event, you can use the fluent interface to create the event. Two elements are always required: the action code and the actor.

The action code is a string that describes the action that was performed. This could be 'create', 'delete', 'update', 'read' or 'execute'. These are defined with the ->asCreate(), ->asDelete(), ->asUpdate(), ->asRead() and ->asExecute() methods.

Next, we need to define the actor that performed the action. This can be a user, a client or a system. This is done with the ->withActor() method. It will need a user that implements the LoggableUser interface.

The event can have some additional fields:

->withTarget can be used to define the target of the action. This can be a user, a client or a system. This can be empty if the actor and target are the same, but different when an actor performs an action onto a target (for instance, an admin (actor) creates a regular user (target)).

->withData can be used to add additional data to the event. This can be any data that is relevant to the event.

->withPiiData can be used to add PII data to the event. This can be any data that is relevant to the event and contains PII data. Depending on the logging configuration, this data might or might not be send to a logger destination.

->withFailed can be used to mark the event as failed. This will add the failed field to the event and set it to true. The second parameter can be used to add a reason for the failure.

->withSource can be used to add a source to the event. This can be any string that describes the source of the event. It's often nothing more than the name of the application (->withSource(config('app.name'))).

->withEventCode can be used to add an event code to the event. This can be any string that describes the event. Often it's already defined by the event class, but it can be overridden.

->logFullRequest can be used to log the full HTTP request. Any sensitive information like passsords, tokens etc will be stripped from the request.

Events

Each event has a unique event code. This code is used to identify the event and can be used to filter events in your logs. For rabbitMQ logging, each event will have a unique routing key that can be used to route events to different queues.

Class Event code routing key Description
DeclarationLogEvent 080001 declaration Declaration event
LogAccessEvent 080002 log_access Accessing logs
VerificationCodeDisabledLogEvent 080003 verification_code_disabled Disabled verification code
RegistrationLogEvent 080004 registration Registration event
------ -------- ------------------------------ ---------------------------------
AccountChangeLogEvent 090001 account_change generic user account changes
UserCreatedLogEvent 090002 user_created created new user
ResetCredentialsLogEvent 090003 reset_credentials reset user credentials
ActivateAccountLogEvent 090004 activate_account Activate account
AdminPasswordResetLogEvent 090005 admin_password_reset Admin password reset
AmpUploadEvent 090006 amp_upload AMP upload
---- ---------- ------------------------------ ---------------------------------
OrganisationCreatedLogEvent 090012 organisation_created Created new organisation
OrganisationChangedLogEvent 090013 organisation_changed Updated organisation (name)
-- ------------ ------------------------------ ---------------------------------
AccountChangeLogEvent[^1] 900101 account_change changed user data
AccountChangeLogEvent 900102 account_change changed roles
AccountChangeLogEvent 900103 account_change changed timeslot
AccountChangeLogEvent 900104 account_change changed active enabled/disabled
AccountChangeLogEvent 900105 account_change reset credentials
-------------- ------------------------------ --------------------------------- ---------------------------------
AccountChangeLogEvent 900201 account_change changed kvtb user data
AccountChangeLogEvent 900202 account_change changed kvtb roles
AccountChangeLogEvent 900203 account_change reset kvtb credentials
-------------- ------------------------------ --------------------------------- ---------------------------------
UserLoginLogEvent 091111 user_login user login
UserLogoutLogEvent 092222 user_logout user logout
UserLoginTwoFactorFailedEvent 093333 user_login_two_factor_failed user login 2fa failed

[^1]: This event is used for all account changes. The event code is used to identify the type of change. Set this with the ->withEventCode() method.

Creating custom events

Creating a custom event is easy. You can create a new class that extends the GeneralLogEvent class.

Usage in other frameworks

This package is framework agnostic. However, there are other packages that provide a framework specific implementation.

Contributing

If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository of this package.

License

This package is open-source and released under the European Union Public License version 1.2. You are free to use, modify, and distribute the package in accordance with the terms of the license.

Part of iCore

This package is part of the iCore project.


All versions of audit-logger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
nesbot/carbon Version ^2.70 | ^3.0
psr/log Version ^3.0
symfony/http-foundation Version ^6.0 | ^7.0 | ^8.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 minvws/audit-logger contains the following files

Loading the files please wait ...