From 6dba6b7a6e99ad445835d28d4a381cba96375659 Mon Sep 17 00:00:00 2001 From: Summer Date: Tue, 25 Jun 2024 13:53:44 +0800 Subject: [PATCH 01/13] feat: Github Actions workflows support --- .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1e0e721 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: PHP Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + php-version: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: bcmath, curl, json + coverage: none + + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist + + - name: Run tests + run: vendor/bin/phpunit From bd74297674bc6e4365dfbfe0679d491c38807025 Mon Sep 17 00:00:00 2001 From: Summer Date: Tue, 25 Jun 2024 14:17:11 +0800 Subject: [PATCH 02/13] fix: Handle PHP 7.2 compatibility issues --- .github/workflows/test.yml | 8 ++++++++ tests/IpToolsTest.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e0e721..caa71ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,5 +30,13 @@ jobs: - name: Install Composer dependencies run: composer install --no-progress --prefer-dist + - name: Install PHPUnit + run: | + if [[ "${{ matrix.php-version }}" == "7.2" ]]; then + composer require --dev phpunit/phpunit:^8; + else + composer require --dev phpunit/phpunit:^9.5; + fi + - name: Run tests run: vendor/bin/phpunit diff --git a/tests/IpToolsTest.php b/tests/IpToolsTest.php index fcb150a..53d36b8 100644 --- a/tests/IpToolsTest.php +++ b/tests/IpToolsTest.php @@ -139,7 +139,7 @@ public function testCidrToIpv6() $this->assertEqualsCanonicalizing( [ - 'ip_start' => '2002:0000:0000:1234:abcd:ffff:c0a8:0101', + 'ip_start' => '2002:0000:0000:1234:0000:0000:0000:0000', 'ip_end' => '2002:0000:0000:1234:ffff:ffff:ffff:ffff', ], $ipTools->cidrToIpv6('2002::1234:abcd:ffff:c0a8:101/64') From ed79c2cbd90bca11d2a71d82b2061193874a16da Mon Sep 17 00:00:00 2001 From: Summer Date: Tue, 25 Jun 2024 14:25:02 +0800 Subject: [PATCH 03/13] fix: Handle PHP 7.2 compatibility issues --- .github/workflows/test.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index caa71ca..2a586ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,15 +28,12 @@ jobs: coverage: none - name: Install Composer dependencies - run: composer install --no-progress --prefer-dist - - - name: Install PHPUnit run: | - if [[ "${{ matrix.php-version }}" == "7.2" ]]; then - composer require --dev phpunit/phpunit:^8; - else - composer require --dev phpunit/phpunit:^9.5; - fi + if [ "${{ matrix.php-version }}" = "7.2" ]; then + composer require --dev phpunit/phpunit:^8.0 + fi + composer run-script set-platform + composer install --no-progress --prefer-dist - name: Run tests run: vendor/bin/phpunit From 2e5d3f050b301ad9a121a8c4858e039bf8a04e08 Mon Sep 17 00:00:00 2001 From: Summer Date: Tue, 25 Jun 2024 14:25:42 +0800 Subject: [PATCH 04/13] fix: Handle PHP 7.2 compatibility issues --- .github/workflows/test.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index caa71ca..2a586ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,15 +28,12 @@ jobs: coverage: none - name: Install Composer dependencies - run: composer install --no-progress --prefer-dist - - - name: Install PHPUnit run: | - if [[ "${{ matrix.php-version }}" == "7.2" ]]; then - composer require --dev phpunit/phpunit:^8; - else - composer require --dev phpunit/phpunit:^9.5; - fi + if [ "${{ matrix.php-version }}" = "7.2" ]; then + composer require --dev phpunit/phpunit:^8.0 + fi + composer run-script set-platform + composer install --no-progress --prefer-dist - name: Run tests run: vendor/bin/phpunit From 818c0dcef1d90538d617e31bdadc0ad62fc74ae9 Mon Sep 17 00:00:00 2001 From: Summer Date: Tue, 25 Jun 2024 14:31:19 +0800 Subject: [PATCH 05/13] fix: Handle PHP 7.2 compatibility issues --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2a586ea..9728d30 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,9 +30,8 @@ jobs: - name: Install Composer dependencies run: | if [ "${{ matrix.php-version }}" = "7.2" ]; then - composer require --dev phpunit/phpunit:^8.0 + composer require --dev phpunit/phpunit:^8.0 --no-update fi - composer run-script set-platform composer install --no-progress --prefer-dist - name: Run tests From 274f307de08d7220499beccfe408e4f815f97eeb Mon Sep 17 00:00:00 2001 From: Summer Date: Tue, 25 Jun 2024 14:34:55 +0800 Subject: [PATCH 06/13] fix: php7.2 compatibility syntax --- tests/DatabaseTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/DatabaseTest.php b/tests/DatabaseTest.php index d3e3330..6573d89 100644 --- a/tests/DatabaseTest.php +++ b/tests/DatabaseTest.php @@ -24,7 +24,7 @@ public function testIpv4CountryCode() { $this->assertEquals( 'US', - $records['countryCode'], + $records['countryCode'] ); } From ff940aaf90826e2fbefd5c47ee7db1e7459fd7a3 Mon Sep 17 00:00:00 2001 From: Summer Date: Tue, 25 Jun 2024 14:39:16 +0800 Subject: [PATCH 07/13] fix: php7.2 compatibility syntax --- .github/workflows/test.yml | 2 +- tests/DatabaseTest.php | 6 +++--- tests/RegionTest.php | 2 +- tests/WebServiceTest.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9728d30..99bafec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 diff --git a/tests/DatabaseTest.php b/tests/DatabaseTest.php index 6573d89..d3c52e4 100644 --- a/tests/DatabaseTest.php +++ b/tests/DatabaseTest.php @@ -35,7 +35,7 @@ public function testIpv4CountryName() { $this->assertEquals( 'United States of America', - $records['countryName'], + $records['countryName'] ); } @@ -54,7 +54,7 @@ public function testIpv6CountryCode() { $this->assertEquals( 'US', - $records['countryCode'], + $records['countryCode'] ); } @@ -65,7 +65,7 @@ public function testIpv6CountryName() { $this->assertEquals( 'United States of America', - $records['countryName'], + $records['countryName'] ); } diff --git a/tests/RegionTest.php b/tests/RegionTest.php index b6fac9d..76394a8 100644 --- a/tests/RegionTest.php +++ b/tests/RegionTest.php @@ -14,7 +14,7 @@ public function testRegionCodeField() $this->assertEquals( 'US-CA', - $region->getRegionCode('US', 'California'), + $region->getRegionCode('US', 'California') ); } } diff --git a/tests/WebServiceTest.php b/tests/WebServiceTest.php index f973e28..8121486 100644 --- a/tests/WebServiceTest.php +++ b/tests/WebServiceTest.php @@ -23,7 +23,7 @@ public function testCountryCode() { $this->assertEquals( 'US', - $records['country_code'], + $records['country_code'] ); } } From 0cbe123ff1317114eb671ac6a610c8091f2de0f1 Mon Sep 17 00:00:00 2001 From: Summer Date: Tue, 25 Jun 2024 14:45:39 +0800 Subject: [PATCH 08/13] fix: php7.2 compatibility --- tests/WebServiceTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/WebServiceTest.php b/tests/WebServiceTest.php index 8121486..bfc90e4 100644 --- a/tests/WebServiceTest.php +++ b/tests/WebServiceTest.php @@ -11,7 +11,12 @@ class WebServiceTest extends TestCase { public function testCredit() { $ws = new \IP2Location\WebService('demo', 'WS24', true); - $this->assertMatchesRegularExpression('/^[0-9]+$/', (string) $ws->getCredit()); + if (method_exists($this, 'assertMatchesRegularExpression')) { + $this->assertMatchesRegularExpression('/^[0-9]+$/', (string) $ws->getCredit()); + }else{ + // Compatible with php 7.2 && phpunit 8.x + $this->assertRegExp('/^[0-9]+$/', (string) $ws->getCredit()); + } } public function testCountryCode() { From d3c073fb7f315fd2c3d4d7fa3bf7c03eeec2cece Mon Sep 17 00:00:00 2001 From: Chris Lim Date: Tue, 18 Mar 2025 10:57:41 +0800 Subject: [PATCH 09/13] Update quickstart.md Removed irrelevant content. --- docs/source/quickstart.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/source/quickstart.md b/docs/source/quickstart.md index e5d18bf..3732421 100644 --- a/docs/source/quickstart.md +++ b/docs/source/quickstart.md @@ -13,10 +13,6 @@ download the BIN database at An outdated BIN database was provided in the databases folder for your testing. You are recommended to visit the above links to download the latest BIN database. ::: -## Requirements - -1. Python 3.5 and above. - ## Installation Install this package using **composer** as below: From da08377e5190438bd2e727ad8d65ecbf89644ed9 Mon Sep 17 00:00:00 2001 From: IP2Location Date: Mon, 19 May 2025 13:59:52 +0800 Subject: [PATCH 10/13] Update LICENSE.TXT --- LICENSE.TXT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.TXT b/LICENSE.TXT index c96a21a..5391874 100644 --- a/LICENSE.TXT +++ b/LICENSE.TXT @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 - 2024 IP2Location.com +Copyright (c) 2023 - 2025 IP2Location.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From f3021c33f0621b3cc048c94e1145dbc7d86a6034 Mon Sep 17 00:00:00 2001 From: IP2Location Date: Mon, 19 May 2025 14:00:48 +0800 Subject: [PATCH 11/13] Update LICENSE.TXT From 9f0a9209c819aac4c5a2a00a62aa5d0490e3f814 Mon Sep 17 00:00:00 2001 From: IP2Location Date: Mon, 19 May 2025 14:23:15 +0800 Subject: [PATCH 12/13] Update LICENSE.TXT From 120aa2eca7df06814d0faa9e077afe220e75e48c Mon Sep 17 00:00:00 2001 From: Chris Lim Date: Fri, 13 Jun 2025 14:40:53 +0800 Subject: [PATCH 13/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 04f0694..9888b2e 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,6 @@ Below are the list of other framework library that you can install and use right ## COPYRIGHT AND LICENSE -Copyright (C) 2005-2024 by IP2Location.com +Copyright (C) 2005-2025 by IP2Location.com License under MIT