Skip to content

Commit 7bdd8b7

Browse files
authored
Merge pull request #1 from serpapi/Init
Deploy SerpApi PHP library
2 parents 0eb065c + 9bdc318 commit 7bdd8b7

36 files changed

Lines changed: 2388 additions & 2 deletions

‎.github/workflows/serpapi-php.yml‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: PHP build
2+
on:
3+
push:
4+
branches: [ master ]
5+
pull_request:
6+
branches: [ master ]
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Setup PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: '8.5'
19+
extensions: mbstring, intl, curl
20+
tools: composer
21+
22+
- name: Install dependencies
23+
run: composer install --prefer-dist --no-progress
24+
25+
- name: Run linter
26+
run: composer run-script lint
27+
28+
run:
29+
runs-on: ubuntu-latest
30+
strategy:
31+
matrix:
32+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: ${{ matrix.php-versions }}
41+
extensions: mbstring, intl, curl
42+
ini-values: post_max_size=256M, max_execution_time=180
43+
44+
- name: Verify required PHP extensions
45+
run: |
46+
php -m | grep -i curl
47+
php -m | grep -i json
48+
49+
- name: Validate composer.json
50+
run: composer validate
51+
52+
- name: Cache Composer packages
53+
uses: actions/cache@v4
54+
with:
55+
path: ~/.composer/cache
56+
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-composer-${{ hashFiles('composer.json') }}
57+
restore-keys: |
58+
${{ runner.os }}-php-${{ matrix.php-versions }}-composer-
59+
60+
- name: Install dependencies
61+
run: composer install --prefer-dist --no-progress
62+
63+
- name: Run test suite
64+
run: composer run-script test
65+
env:
66+
API_KEY: ${{ secrets.API_KEY }}

‎.gitignore‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
vendor/*
2+
.vscode/*
3+
4+
# PHPUnit
5+
.phpunit.result.cache
6+
7+
# MacOS Specific
8+
.DS_Store
9+
10+
composer.lock
11+
composer.phar
12+
tmp/
13+
14+
.env
15+
.env.*

‎MIT-LICENSE.txt‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018-2026 SerpApi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎Makefile‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Default target
2+
all: install readme lint test
3+
4+
# Clean up the project
5+
clean:
6+
rm -rf vendor/
7+
8+
# Install the necessary libraries and dependencies
9+
install:
10+
composer install --prefer-dist --no-progress
11+
12+
# Run PSR12 lint
13+
lint:
14+
vendor/bin/phpcs
15+
16+
# Run the tests
17+
test:
18+
vendor/bin/phpunit -c phpunit.xml
19+
20+
# Generate README from ERB template
21+
readme:
22+
erb -T '-' README.md.erb > README.md

0 commit comments

Comments
 (0)