From ec22a5f82a609511c2dec3911fedc62b71a76d76 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 31 Jul 2017 19:48:52 -0500 Subject: [PATCH 1/5] remove package helpers that return HTML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit these are better handled by components and slots. they were also very specific to my use case, and I’m trying to make the package a little more generic. i personally do not use these anymore either. I use components --- src/Helpers/buttons.php | 231 ---------------------------------------- src/Helpers/confirm.php | 56 ---------- src/Helpers/hint.php | 58 ---------- src/config/helpers.php | 4 +- 4 files changed, 2 insertions(+), 347 deletions(-) delete mode 100644 src/Helpers/buttons.php delete mode 100644 src/Helpers/confirm.php delete mode 100644 src/Helpers/hint.php diff --git a/src/Helpers/buttons.php b/src/Helpers/buttons.php deleted file mode 100644 index ba0c224..0000000 --- a/src/Helpers/buttons.php +++ /dev/null @@ -1,231 +0,0 @@ -'; - - //return - return $return; - } -} - -if (!function_exists('viewButton')) { - - /** - * view button - * - * similar but not identical to 'open button' - * this button is more for user facing - * - * @param string $url - * @param string $title - * @return string - */ - function viewButton($url, $title = 'View') - { - //setup output - $return = ''; - - //return - return $return; - } -} - -if (!function_exists('manageButton')) { - - /** - * manage button - * - * @param string $url - * @param string $title - * @return string - */ - function manageButton($url, $title = 'Manage') - { - //setup output - $return = ''; - - //return - return $return; - } -} - -if (!function_exists('showButton')) { - - /** - * open button - * - * @param string $url - * @param string $title - * @return string - */ - function showButton($url, $title = 'Open') - { - //setup output - $return = ''; - - //return - return $return; - } -} - -if (!function_exists('editButton')) { - - /** - * edit button - * - * @param string $url - * @param string $title - * @return string - */ - function editButton($url, $title = 'Edit') - { - //setup output - $return = ''; - - //return - return $return; - } -} - -if (!function_exists('deleteButton')) { - - /** - * delete button - * - * @param string $url - * @param string $message - * @param string $buttonTitle - * @param string $title - * @return string - */ - function deleteButton($url, $message = null, $buttonTitle = 'Delete', $title = null) - { - //setup output - $return = ''; - - //return - return $return; - } -} - -if (!function_exists('cancelButton')) { - - /** - * cancel button - * - * @param string $url - * @param string $message - * @param string $buttonTitle - * @param string $title - * @return string - */ - function cancelButton($url, $message = null, $buttonTitle = 'Cancel', $title = null) - { - //setup output - $return = ''; - - //return - return $return; - } -} - -if (!function_exists('backButton')) { - - /** - * back button - * - * @return string - */ - function backButton() - { - return ' Back'; - } -} - -if (!function_exists('myButton')) { - - /** - * @param string $url - * @param string $title - * @param string $message - * @param string $buttonTitle - * @return string - */ - function myButton($url, $title, $message, $buttonTitle) - { - //setup output - $return = ''; - - //return - return $return; - } -} diff --git a/src/Helpers/confirm.php b/src/Helpers/confirm.php deleted file mode 100644 index 5385288..0000000 --- a/src/Helpers/confirm.php +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - '; - - //return - return $return; - } -} diff --git a/src/Helpers/hint.php b/src/Helpers/hint.php deleted file mode 100644 index 6dc4bbe..0000000 --- a/src/Helpers/hint.php +++ /dev/null @@ -1,58 +0,0 @@ -'; - - //return - return $return; - } -} - -if (!function_exists('tooltip')) { - - /** - * tooltip - * - * @param string $message - * @param string $action - * @param string $placement - * @return string - */ - function tooltip($message, $placement = 'right', $action = 'hover') - { - //setup return - $return = ''; - - //return - return $return; - } -} diff --git a/src/config/helpers.php b/src/config/helpers.php index d51adf2..4bffb43 100644 --- a/src/config/helpers.php +++ b/src/config/helpers.php @@ -7,10 +7,10 @@ | Package Helpers |-------------------------------------------------------------------------- | - | This package comes with many pre-built helpers. Activate the ones + | This package comes with some pre-built helpers. Activate the ones | you wish to use by selecting them here. Valid options include: | - | buttons, confirm, datetime, feedback, formatter, hint, image, money, validation + | datetime, feedback, formatter, image, money, validation | */ From 4367c03fd068241ace3b575ef605501a4676aa6b Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 31 Jul 2017 19:49:25 -0500 Subject: [PATCH 2/5] bump PHP version requirement to 5.6.0 it is time people. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4db1b45..64b85d9 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.5.9", + "php": ">=5.6.0", "illuminate/console": "~5.2", "illuminate/contracts": "~5.2", "illuminate/support": "~5.2" From 3691e3a681bfba2ceb32fff037d126d41f8661dc Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 31 Jul 2017 19:49:51 -0500 Subject: [PATCH 3/5] add note about laravel's automatic package discovery --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0f1c092..4615255 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ Add the service provider to the providers array in `config/app.php`. ]; ``` +If you are using Laravel's automatic package discovery, you can skip this step. + ## Publishing You can publish everything at once From 3e1c5dfa2b9810769c85d60d9c7e561fc7a7a6de Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 31 Jul 2017 19:51:48 -0500 Subject: [PATCH 4/5] update money helper to use MoneyPHP package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit having a PHP community money package is much better than me having my own maintained one. this allows for community improvements. at the time I wrote my money package, there was not really a clear winner in that area, but it’s definitely time to move on. --- composer.json | 3 +++ src/Helpers/money.php | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 64b85d9..06b3e87 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,9 @@ "scrutinizer/ocular": "~1.1", "squizlabs/php_codesniffer": "~2.3" }, + "suggest": { + "moneyphp/money": "Money value object." + }, "autoload": { "psr-4": { "browner12\\helpers\\": "src" diff --git a/src/Helpers/money.php b/src/Helpers/money.php index eac2fc2..234ddd9 100644 --- a/src/Helpers/money.php +++ b/src/Helpers/money.php @@ -5,22 +5,26 @@ /** * money * - * @param float|\browner12\money\Money $money - * @param string $currency + * @param float|\Money\Money $money + * @param string $currency * @return string */ function money($money, $currency = 'usd') { + //formatter + $numberFormatter = new \NumberFormatter('en_US', \NumberFormatter::CURRENCY); + //money object - if ($money instanceof \browner12\money\Money) { - $currency = $money->getCurrency()->currency(); - $money = $money->value(); - } + if ($money instanceof \Money\Money) { - //formatter - $cf = new NumberFormatter('eng', NumberFormatter::CURRENCY); + $currencies = new \Money\Currencies\ISOCurrencies(); + + $moneyFormatter = new \Money\Formatter\IntlMoneyFormatter($numberFormatter, $currencies); + + return $moneyFormatter->format($money); + } //return - return $cf->formatCurrency($money, $currency); + return $numberFormatter->formatCurrency($money, $currency); } } From 7e1231eb6e5512b03432a5d0f9a14d4c726c23ba Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 31 Jul 2017 19:55:47 -0500 Subject: [PATCH 5/5] update changelog in prep for release --- CHANGELOG.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ff707c..2115023 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,18 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip ## [UNRELEASED] +## [2.0.0] - 2017-07-31 + +### Added +- added note about Laravel package discovery in setup notes [3691e3a](https://github.com/browner12/helpers/commit/3691e3a681bfba2ceb32fff037d126d41f8661dc) + +### Changed +- bumped PHP minimum version to 5.6.0 [4367c03](https://github.com/browner12/helpers/commit/4367c03fd068241ace3b575ef605501a4676aa6b) +- updated the money helper to use the [MoneyPHP Package](https://github.com/moneyphp/money) [3e1c5df](https://github.com/browner12/helpers/commit/3e1c5dfa2b9810769c85d60d9c7e561fc7a7a6de) + +### Removed +- removed helpers that return HTML. these are better handled by [components](https://laravel.com/docs/5.4/blade#components-and-slots). [ec22a5f](https://github.com/browner12/helpers/commit/ec22a5f82a609511c2dec3911fedc62b71a76d76) + ## [1.1.1] - 2017-07-16 ### Changed @@ -45,7 +57,8 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip ### Added - new helpers package -[unreleased]: https://github.com/browner12/helpers/compare/v1.1.1...HEAD +[unreleased]: https://github.com/browner12/helpers/compare/v2.0.0...HEAD +[2.0.0]: https://github.com/browner12/helpers/compare/v1.1.1...v2.0.0 [1.1.1]: https://github.com/browner12/helpers/compare/v1.1.0...v1.1.1 [1.1.0]: https://github.com/browner12/helpers/compare/v1.0.4...v1.1.0 [1.0.4]: https://github.com/browner12/helpers/compare/v1.0.3...v1.0.4