https://github.com/zguillez/php-xmlog
PHP module for create XML and LOG files
https://github.com/zguillez/php-xmlog
log packagist php xml
Last synced: 9 months ago
JSON representation
PHP module for create XML and LOG files
- Host: GitHub
- URL: https://github.com/zguillez/php-xmlog
- Owner: zguillez
- Created: 2016-03-12T19:27:15.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-10-14T17:16:35.000Z (over 6 years ago)
- Last Synced: 2025-01-11T04:35:07.890Z (over 1 year ago)
- Topics: log, packagist, php, xml
- Language: PHP
- Homepage: https://zguillez.tools/
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# php-xmlog

[](http://doge.mit-license.org)
[](https://gitter.im/zguillez/php-xmlog?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
PHP module for create XML and LOG files
# Getting Started
### Add package to composer.json
`composer require zguillez/php-xmlog`
//packaje.json
{
"require": {
"zguillez/php-xmlog": "^1.1.3"
}
}
# Usage:
require 'vendor/autoload.php';
use Z\Log;
$params["filename"] = "register";
$params["path"] = "./logs/";
$log = new Log($params);
On this example, "register" is the name of the log file and "./logs" is the folder on this files will be saved. **This folder must exits and have write permitions**.
$log->insert('This is an update!');
This will create a file "register.log" with the text "This is an update!".
For create a XML file instead LOG file:
$params["type"] = Log::XML;
## Options (true/false):
### 1 dated:
$params["dated"] = true;
Create a dated file name:
* true: register_2016-03-12_17:10:17.log
* false (default): register.log
### 2 clear:
$params["clear"] = true;
Overwrite last file:
* true: register.log (overwrite the file with new log text)
* false (default): register.log (new log text will added in new line)
### 3 backup:
$params["backup"] = true;
Backup last file:
* true: register_2016-03-12_17:10:17_backup.log
* false (default): (no backup file)
## Configuration:
You can override the log options by a config function.
$log->config(["dated"=>true]);
# Example:
require 'vendor/autoload.php';
$params["type"] = Log::LOG;
$params["filename"] = "register";
$params["path"] = "./logs/";
$params["dated"] = false;
$params["clear"] = false;
$params["backup"] = false;
$log = new Log($params);
$log->config(["dated"=>true]);
$log->insert('This is update one!');
$log->insert('This is update two!');
# Contributing and issues
Contributors are welcome, please fork and send pull requests! If you have any ideas on how to make this project better then please submit an issue or send me an [email](mailto:mail@zguillez.io).
# License
©2019 Zguillez.io
Original code licensed under [MIT](https://en.wikipedia.org/wiki/MIT_License) Open Source projects used within this project retain their original licenses.
# Changelog
### v1.1.0 (September 9, 2016)
* Configuration object
### v1.0.0 (March 12, 2016)
* Initial implementation