Skip to content

Commit 77310b8

Browse files
Merge branch 'trunk' into add/architecture-definition
2 parents 3ff376e + 43ef024 commit 77310b8

File tree

6 files changed

+138
-1
lines changed

6 files changed

+138
-1
lines changed

.gitattributes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.editorconfig export-ignore
2+
.gitattributes export-ignore
3+
/.github/ export-ignore
4+
.gitignore export-ignore
5+
/*.md export-ignore
6+
/LICENSE.md -export-ignore
7+
/README.md -export-ignore
8+
/docs/ export-ignore
9+
/tests/ export-ignore
10+
/vendor/ export-ignore
11+
/phpcs.xml.dist export-ignore
12+
/phpstan.neon.dist export-ignore
13+
/phpunit.xml.dist export-ignore

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ Thank you for your interest in contributing to the PHP AI Client package! Here y
44

55
## Coding standards
66

7-
While this project is stewarded by [WordPress AI Team](https://make.wordpress.org/ai/) members and contributors, it is a WordPress agnostic PHP package that can benefit any project in the PHP ecosystem. As such, all code must follow the [PSR-12 Coding Standards](https://www.php-fig.org/psr/psr-12/).
7+
While this project is stewarded by [WordPress AI Team](https://make.wordpress.org/ai/) members and contributors, it is a WordPress agnostic PHP package that can benefit any project in the PHP ecosystem. As such, all code must follow the [PER Coding Style](https://www.php-fig.org/per/coding-style/), which extends [PSR-12](https://www.php-fig.org/psr/psr-12/). Note that the PHPCS config is using PSR-12 due to the fact that it does not support PER, yet. So PER is preferred, but PSR-12 is acceptable.
8+
9+
All parameters, return values, and properties must use explicit type hints, except in cases where providing the correct type hint would be impossible given limitations of the oldest supported PHP version (see below).
10+
11+
## PHP Compatibility
12+
13+
All code must be backward compatible with PHP 7.4, which is the minimum required PHP version for this project.
814

915
## Guidelines
1016

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)