From bfe714b179845281e29686ab2307613cb90c8087 Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Thu, 8 Aug 2024 01:18:19 -0400 Subject: [PATCH] fixes to support composer / packagist --- LICENSE | 21 ++++++++++ classes/{logger.php => Logger.php} | 17 ++++++-- ...tempus_debugger.php => TempusDebugger.php} | 0 composer.json | 41 ++++++++++++------- config/constants.php | 4 +- vendor/.gitignore | 2 + 6 files changed, 67 insertions(+), 18 deletions(-) create mode 100644 LICENSE rename classes/{logger.php => Logger.php} (85%) rename classes/{tempus_debugger.php => TempusDebugger.php} (100%) create mode 100644 vendor/.gitignore diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c32ae1d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Joey Kimsey + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/classes/logger.php b/classes/Logger.php similarity index 85% rename from classes/logger.php rename to classes/Logger.php index d61d465..f898e05 100644 --- a/classes/logger.php +++ b/classes/Logger.php @@ -6,7 +6,6 @@ * @author Joey Kimsey */ namespace TheTempusProject\Canary\Classes; -use TheTempusProject\Bedrock\Functions\Date; class Logger { public $file; @@ -97,12 +96,24 @@ class Logger { } private function timestamp() { - $dateString = Date::getReadableDate( time() ); + $dateString = self::getReadableDate( time() ); return '['.$dateString.'] - '; } private function typestamp( $type ) { - $dateString = Date::getReadableDate( time() ); + $dateString = self::getReadableDate( time() ); return '[' . strtoupper( $type ) . '] - '; } + + public static function getReadableDate( $timestamp, $with_timezone = false ) { + if ( $with_timezone ) { + $date = new \DateTime(); + $date->setTimestamp( $timestamp ); + $timezone = new \DateTimeZone( self::getTimezone() ); + $date->setTimezone( $timezone ); + $formattedDate = $date->format('Y-m-d H:i:s'); + return $formattedDate; + } + return date( 'Y-m-d H:i:s', $timestamp ); + } } diff --git a/classes/tempus_debugger.php b/classes/TempusDebugger.php similarity index 100% rename from classes/tempus_debugger.php rename to classes/TempusDebugger.php diff --git a/composer.json b/composer.json index 725a445..faad7cb 100644 --- a/composer.json +++ b/composer.json @@ -1,27 +1,40 @@ { - "name": "thetempusproject/tempusdebugger", + "name": "thetempusproject/canary", "type": "library", - "description": "Framework for sending php messages to chrome for in-browser debugging.", + "description": "Functionality for tracking, logging, and sending log messages to chrome for debugging.", "license": "MIT", "minimum-stability": "dev", - "keywords": ["php","tools","debugging","thetempusproject"], - "homepage": "https://github.com/TheTempusProject/TempusDebugger", - "authors": [ + "keywords": + [ + "php", + "tools", + "debugging", + "thetempusproject" + ], + "homepage": "https://git.thetempusproject.com/the-tempus-project/canary", + "authors": + [ { "name": "Joey Kimsey", "email": "Joey@thetempusproject.com", - "homepage": "https://TheTempusProject.com", + "homepage": "https://JoeyKimsey.com", "role": "Lead Developer" } ], - "require": { - "php": ">=5.4.0" + "require": + { + "php": ">=8.1.0" }, - "autoload": { - "classmap": [ - "TempusDebugger.php", - "TempusTools.php" + "autoload": + { + "psr-4": + { + "TheTempusProject\\Canary\\Classes\\": "classes" + }, + "files": + [ + "config/constants.php", + "bin/canary.php" ] } -} - +} \ No newline at end of file diff --git a/config/constants.php b/config/constants.php index 39226cd..6ed83aa 100644 --- a/config/constants.php +++ b/config/constants.php @@ -50,4 +50,6 @@ if ( ! defined('CANARY_DEBUG_TO_CONSOLE' ) ) { } # Tell the app all constants have been loaded. -define( 'CANARY_CONSTANTS_LOADED', true ); +if ( ! defined('CANARY_CONSTANTS_LOADED' ) ) { + define( 'CANARY_CONSTANTS_LOADED', true ); +} diff --git a/vendor/.gitignore b/vendor/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/vendor/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file