Skip to content

Commit d9e41b1

Browse files
Merge pull request #16 from borkweb/add/composer-json
Add composer.json with PHP 7.4+ support, phpcs, phpstan, and phpunit
2 parents 9cce0a7 + b2ab4d6 commit d9e41b1

File tree

4 files changed

+118
-0
lines changed

4 files changed

+118
-0
lines changed

composer.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"name": "wordpress/php-ai-client",
3+
"description": "A provider agnostic PHP AI client SDK to communicate with any generative AI models of various capabilities using a uniform API.",
4+
"license": "GPL-2.0-or-later",
5+
"type": "library",
6+
"keywords": [
7+
"ai",
8+
"api",
9+
"llm"
10+
],
11+
"authors": [
12+
{
13+
"name": "WordPress AI Team",
14+
"homepage": "https://make.wordpress.org/ai/"
15+
}
16+
],
17+
"homepage": "https://github.com/WordPress/php-ai-client",
18+
"support": {
19+
"issues": "https://github.com/WordPress/php-ai-client/issues",
20+
"source": "https://github.com/WordPress/php-ai-client"
21+
},
22+
"require": {
23+
"php": ">=7.4",
24+
"ext-json": "*"
25+
},
26+
"require-dev": {
27+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
28+
"phpstan/phpstan": "~2.1",
29+
"phpunit/phpunit": "^9.5 || ^10.0",
30+
"squizlabs/php_codesniffer": "^3.7"
31+
},
32+
"minimum-stability": "dev",
33+
"prefer-stable": true,
34+
"autoload": {
35+
"psr-4": {
36+
"WordPress\\AiClient\\": "src/"
37+
}
38+
},
39+
"autoload-dev": {
40+
"psr-4": {
41+
"WordPress\\AiClient\\Tests\\": "tests/"
42+
}
43+
},
44+
"config": {
45+
"allow-plugins": {
46+
"dealerdirect/phpcodesniffer-composer-installer": true
47+
},
48+
"optimize-autoloader": true,
49+
"platform": {
50+
"php": "7.4"
51+
},
52+
"sort-packages": true
53+
},
54+
"scripts": {
55+
"lint": [
56+
"@phpcs",
57+
"@phpstan"
58+
],
59+
"phpcbf": "phpcbf",
60+
"phpcs": "phpcs",
61+
"phpstan": "phpstan analyze",
62+
"phpunit": "phpunit"
63+
}
64+
}

phpcs.xml.dist

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="PHP AI Client Coding Standards">
3+
<description>PSR-12 coding standards for PHP AI Client SDK</description>
4+
5+
<!-- Scan these files -->
6+
<file>src</file>
7+
8+
<!-- Ignore vendor directory -->
9+
<exclude-pattern>*/vendor/*</exclude-pattern>
10+
11+
<!-- Use PSR-12 standard -->
12+
<rule ref="PSR12"/>
13+
14+
<!-- Show progress, show sniff codes in all reports -->
15+
<arg value="sp"/>
16+
17+
<!-- Set minimum supported PHP version -->
18+
<config name="testVersion" value="7.4-"/>
19+
20+
<!-- Enable colors in output -->
21+
<arg name="colors"/>
22+
23+
<!-- Check PHP syntax -->
24+
<arg name="parallel" value="8"/>
25+
</ruleset>

phpstan.neon.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
parameters:
2+
level: max
3+
paths:
4+
- src

src/DummyForAnalysis.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/**
4+
* DummyForAnalysis class file.
5+
*
6+
* @package WordPress\AiClient
7+
*/
8+
9+
declare(strict_types=1);
10+
11+
namespace WordPress\AiClient;
12+
13+
/**
14+
* Class DummyForAnalysis
15+
*
16+
* This is a dummy class for testing that phpcs and phpstan are working.
17+
* It should be removed once we have a real class.
18+
*/
19+
class DummyForAnalysis
20+
{
21+
public function dummy(): void
22+
{
23+
// Placeholder.
24+
}
25+
}

0 commit comments

Comments
 (0)