Skip to content

Commit 2e8dd8d

Browse files
authored
Add SQLite extension check (#13)
* Add MissingSqliteExtensionException and check for SQLite extension in service provider * Bump version to 1.3.1 in composer.json
1 parent f657820 commit 2e8dd8d

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "io238/laravel-iso-countries",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Ready-to-use Laravel models and relations for country (ISO 3166), language (ISO 639-1), and currency (ISO 4217) information with multi-language support.",
55
"keywords": [
66
"laravel",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Io238\ISOCountries\Exceptions;
4+
5+
use Exception;
6+
7+
class MissingSqliteExtensionException extends Exception
8+
{
9+
protected $message = 'The PHP extension pdo_sqlite is not installed or enabled. This package requires the SQLite extension.';
10+
}

src/ISOCountriesServiceProvider.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
use Illuminate\Support\ServiceProvider;
66
use Io238\ISOCountries\Commands\Build;
77

8+
use Io238\ISOCountries\Exceptions\MissingSqliteExtensionException;
9+
810

911
class ISOCountriesServiceProvider extends ServiceProvider {
1012

@@ -13,6 +15,10 @@ class ISOCountriesServiceProvider extends ServiceProvider {
1315

1416
public function boot()
1517
{
18+
// Prüfe, ob die SQLite-Erweiterung geladen ist
19+
if (!extension_loaded('pdo_sqlite')) {
20+
throw new MissingSqliteExtensionException();
21+
}
1622
// Create custom database connection
1723

1824
// Use Sqlite database path from config, if it exists

0 commit comments

Comments
 (0)