Download the PHP package chance-fyi/operation-log without Composer

On this page you can find all versions of the php package chance-fyi/operation-log. 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 operation-log

支持 Laravel 的 ORM 、Hyperf 的 ORM 与 ThinkPHP 的 ORM 。可以生成增、删、改,包括批量增、删、改,以及 使用 DB 操作的日志。

通过模型事件与获取器,自动生成可读性高的操作日志。2.0 版本已弃用模型事件,因为批量操作没有触发模型事件,使用模型事件无法覆盖所有模型对数据库的操作以及 DB 操作。

安装

composer require chance-fyi/operation-log

注意

因为使用了单例,所以在常驻内存的框架中使用一定要在每次请求结束之后将生成的日志清空。

使用 Laravel 的 ORM

首先在数据库的配置文件 config/database.php 中增加两个配置项 modelNamespacelogKey

然后注册 MySQL 数据库连接的解析器。

使用 ThinkPHP 的 ORM

在数据库的配置文件 config/database.php 中增加三个配置项 querymodelNamespacelogKey,并修改 typebuilder

日志主键

可在模型中设置$logKey属性修改需要记录的主键名称。

可读性设置

通过表注释、字段注释与获取器来生成可读性的日志。

表注释与字段注释

image-20220309172842186

也可以在模型中通过$tableComment$columnComment设置表注释与字段注释。

获取器

设置一个名为字段名_text的获取器。

日志生成忽略的字段

可在模型中通过 $ignoreLogFields 设置该表不希望生成日志的字段。

数据表不生成日志

可在模型中通过 $doNotRecordLog 设置该表不在生成日志。

表模型映射关系

如果模型文件名与表名不相同,将查找不到表所对应的模型。也就无法完成上面一些,需要在模型中设置的功能。所以可以设置一个表与模型的映射关系,来帮助查找表所对应的模型。

如果是在 ThinkPHP、Laravel、webman 框架中使用,可使用 php vendor/bin/chance-fyi-operation-log 模型所在目录 命令来自动构建所选目录中递归查找到的所有模型与表的映射关系。如果命令执行失败,也可选择手动维护映射关系,并通过以下方法手动注入表模型映射关系。

获取日志信息

清除日志信息

启用禁用

效果图

image

image

image

image

image

image


All versions of operation-log with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-json Version *
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 chance-fyi/operation-log contains the following files

Loading the files please wait ....