Skip to content

Commit db56308

Browse files
author
Fredrick Peter
committed
composer.json update
1 parent df309c9 commit db56308

File tree

4 files changed

+43
-10
lines changed

4 files changed

+43
-10
lines changed

PDF.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ static public function read(string $path)
127127
Tame::readPDFToBrowser($path);
128128
}
129129

130-
131130
/**
132131
* Check If DOM PDF has been installed
133132
*
@@ -140,7 +139,7 @@ static private function isDOMPDFInstalled()
140139
return new Options();
141140
} else {
142141
throw new CustomException(
143-
"Class Dompdf\Options not found: \nRequire he package by running: `composer require dompdf/dompdf`\n" .
142+
"Class Dompdf\Options not found: \nRequire the package by running: `composer require dompdf/dompdf`\n" .
144143
(new Exception)->getTraceAsString()
145144
);
146145
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Prior to installing `support package` get the [Composer](https://getcomposer.org
3131
**Step 1** — update your `composer.json`:
3232
```composer.json
3333
"require": {
34-
"tamedevelopers/support": "^1.0.0"
34+
"tamedevelopers/support": "^1.0.2"
3535
}
3636
```
3737

Slugify.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
namespace Tamedevelopers\Support;
66

7+
use Exception;
78
use Cocur\Slugify\Slugify as CocurSlugify;
9+
use Tamedevelopers\Support\Capsule\Manager;
10+
use Tamedevelopers\Support\Capsule\CustomException;
811

912
/*
1013
* To change this license header, choose License Headers in Project Properties.
@@ -35,6 +38,8 @@ class Slugify
3538
*/
3639
static public function slug($word, $language = null, $separator = "-", $case = true)
3740
{
41+
self::isSlugifyInstalled();
42+
3843
// get language
3944
$language = self::switchLanguage($language);
4045

@@ -153,4 +158,36 @@ static private function supportedLanguage()
153158
'vietnamese'
154159
];
155160
}
161+
162+
/**
163+
* Check If DOM PDF has been installed
164+
*
165+
* @return mixed
166+
*/
167+
static private function isSlugifyInstalled()
168+
{
169+
try {
170+
if (class_exists('Cocur\Slugify\Slugify')) {
171+
return true;
172+
} else {
173+
throw new CustomException(
174+
"Class Cocur\Slugify\Slugify not found: \nRequire the package by running: `composer require cocur/slugify`\n" .
175+
(new Exception)->getTraceAsString()
176+
);
177+
}
178+
} catch (CustomException $e) {
179+
// Handle the exception silently (turn off error reporting)
180+
error_reporting(0);
181+
182+
Manager::setHeaders(404, function() use($e){
183+
184+
// create error logger
185+
Env::bootLogger();
186+
187+
// Trigger a custom error
188+
trigger_error($e->getMessage(), E_USER_ERROR);
189+
});
190+
}
191+
}
192+
156193
}

composer.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,19 @@
1616
],
1717
"require": {
1818
"php": ">=7.2.5",
19-
"ext-ctype": "*",
2019
"psr/log": "^1.0 || ^1.1.4",
20+
"ext-ctype": "*",
2121
"ext-mbstring": "*",
22-
"vlucas/phpdotenv": "^5.3",
23-
"cocur/slugify": "^4.2",
2422
"symfony/var-dumper": "^5.4.3"
2523
},
2624
"suggest": {
2725
"symfony/var-dumper": "Required to use the dd function (^6.0).",
2826
"dompdf/dompdf": "Required to use the PDF class (^2.0.2).",
29-
"vlucas/phpdotenv": "Required to use the Env class and env helper (^5.4.1)."
27+
"cocur/slugify": "Required to use the slugify class (^4.2.0).",
28+
"vlucas/phpdotenv": "Required to use the Env class and env helper (^5.5.0)."
3029
},
3130
"conflict": {
32-
"symfony/var-dumper": ">=6.0.0",
33-
"vlucas/phpdotenv": ">=5.4",
34-
"cocur/slugify": ">=4.3"
31+
"symfony/var-dumper": ">=6.0.0"
3532
},
3633
"autoload": {
3734
"files": [

0 commit comments

Comments
 (0)