Skip to content

1.0.1

Choose a tag to compare

@elminson elminson released this 17 May 19:57
· 36 commits to main since this release

Release Notes v1.0.1

New Features

  • Added comprehensive SQL query logging support for Laravel applications
  • Implemented support for both console and file-based logging
  • Added PDO statement query logging with bound parameters support
  • Integrated Pest PHP for enhanced testing capabilities

Configuration

  • Added environment variables support:
    DB_LOGGER_ENABLED=true
    DB_LOGGER_CONSOLE_OUTPUT=true
    DB_LOGGER_FILE_LOGGING=true
    DB_LOGGER_FILE_PATH=storage/logs/queries.log
  • Added service provider for easy integration
  • Implemented flexible configuration options

Usage Examples

Basic Query Logging

$logger = new DatabaseQueryLogger([
    'enabled' => true,
    'console_output' => true,
    'file_logging' => true,
    'log_file' => storage_path('logs/queries.log')
]);

$query = DB::table('users')->where('email', 'example@example.com');
$logger->logQuery($query);

PDO Statement Logging

$stmt = $pdo->prepare('SELECT * FROM users WHERE email = :email');
$stmt->bindParam(':email', 'example@example.com');
$logger->logQuery($stmt, ['example@example.com']);

Configuration Methods

$logger->enable(true);
$logger->enableConsoleOutput(true);
$logger->setLogFile(storage_path('logs/queries.log'));

Enhancements

  • Added code coverage support for tests
  • Improved query formatting for better readability
  • Enhanced error handling and parameter binding
  • Added support for different parameter types (string, integer, boolean, null)

Technical Updates

  • Added Pest PHP plugin support in composer.json
  • Updated dependencies to latest stable versions
  • Added test coverage configuration
  • Improved code organization and structure

Testing

  • Added comprehensive test suite for query logging
  • Implemented tests for different logging scenarios:
    • Console output logging
    • File-based logging
    • PDO statement logging
    • Parameter binding tests
    • Different data type handling tests

Dependencies

  • Updated to PHP 8.1+ requirement
  • Added Laravel 10.x support
  • Integrated Pest PHP for testing
  • Added Laravel Pint for code formatting

Bug Fixes

  • Fixed styling issues
  • Resolved PDOStatementWrapper integration
  • Fixed parameter binding issues
  • Addressed composer plugin configuration

Documentation

  • Added inline code documentation
  • Improved method documentation
  • Added usage examples in tests
  • Updated README with comprehensive usage instructions
  • Added environment configuration guide

This release focuses on providing a robust and flexible database query logging solution for Laravel applications, with emphasis on code quality, testing, and maintainability. The package now includes comprehensive documentation and examples for easy integration into any Laravel project.