use Doctrine\DBAL\DriverManager;
require_once __DIR__ . '/vendor/autoload.php';
$connectionParams = [
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This PHP script creates CSV snapshots of all tables in a specified MySQL database. | |
* Useful for database analysis and backup purposes. The script connects to the MySQL | |
* database using PDO, retrieves the list of all tables (excluding specified ones), | |
* and then exports each table's contents to a CSV file. The CSV files are saved in a | |
* directory named 'snapshots' inside the script's directory, with each run generating | |
* a new timestamped subdirectory for organization. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* MySQL Table Change Logging Trigger Generator Script | |
* | |
* This script generates triggers for all tables in the $dbname database, | |
* which log INSERT, UPDATE, and DELETE operations. | |
* The triggers record modifications in the 'change_log' table, | |
* storing the name of the affected table, the type of change (INSERT, UPDATE, DELETE), | |
* the timestamp of the change, and the old and new data of the affected rows in JSON format. |
diff --brief --recursive /path/to/dir1 /path/to/dir2
# yum remove php* -y
yum clean all
yum makecache
yum update -y
yum install dnf -y
dnf upgrade --refresh
yum-config-manager --disable remi-php74
yum-config-manager --enable remi-php81
dnf install php php-cli php-common php-pdo php-xml php-mbstring php-zip php-devel php-curl php-pear php-json php-xdebug -y
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* composer require guzzlehttp/psr7 | |
* composer require laminas/laminas-diactoros | |
* composer require slim/psr7 | |
* composer require nyholm/psr7 | |
* composer require nyholm/psr7-server | |
* | |
* https://www.php-fig.org/psr/psr-7/ | |
* https://www.php-fig.org/psr/psr-17/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//https://www.linkedin.com/learning/advanced-php/create-an-iterator?u=2113185 | |
class CsvIterator extends IteratorIterator | |
{ | |
public function __construct(string $path) | |
{ | |
parent::__construct(new SplFileObject($path, 'r')); | |
$file = $this->getInnerIterator(); |
NewerOlder