-
Notifications
You must be signed in to change notification settings - Fork 21
feat(php): Add PHP clients init + PHP search client #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
7a9a14e
feat(php): add raw templates
damcou f87a1da
feat: add appid/apiKey init
damcou 5e77ec0
feat: strippin' like crazy
damcou 38b2e5e
feat: add PHP search client
damcou dca0cbf
Merge branch 'main' into feat/APIC-238/add-php-client
damcou 4aea106
feat(php): Remove unwanted files on the php client branch (#79)
damcou 000f0a4
fix: cleanup some files
damcou b02f974
Merge branch 'main' into feat/APIC-238/add-php-client
damcou 2cdfacf
Merge branch 'main' into feat/APIC-238/add-php-client
damcou 20e10e5
chore(php): Add PHP linting and CI workflow (#81)
damcou 22d4aa6
Merge branch 'main' into feat/APIC-238/add-php-client
damcou 0fc486f
feat(php): Add Retry Strategy & cache for the PHP client (#95)
damcou 324e4d8
feat(php): Add remaining php clients (#106)
damcou ee1bc60
Merge branch 'main' into feat/APIC-238/add-php-client
damcou 9153f4c
fix: store spec in CI script
millotp 16fdef6
fix: CI
damcou eac80d2
Merge remote-tracking branch 'origin/fix/ci-spec-script' into feat/AP…
damcou 11ba4ed
fix: CI
damcou aa06951
fix: openapitools.json
damcou 9a5f6da
fix: update ci
damcou 663750e
fix CI
millotp 490bd27
fix: update ci
damcou 55cdfb8
Merge branch 'feat/APIC-238/add-php-client' of https://github.com/alg…
damcou cc586f2
fix: php cmd
shortcuts 098ebb3
regen?
shortcuts dbc8d81
split models per client
shortcuts 2858be5
Merge branch 'main' into feat/APIC-238/add-php-client
damcou 64f455f
fix: use global ModelInterface to avoid errors in CI
damcou a5968c6
Merge branch 'main' into feat/APIC-238/add-php-client
damcou acdc2ad
fix: CTS CI
damcou df509f8
fix: typo
damcou fc9dd80
fix: CI
damcou da8d820
fix: changes after review
damcou 50ab7a1
Merge branch 'main' into feat/APIC-238/add-php-client
damcou 1d69d81
fix: update CI + remove composer on playground
damcou f50c98a
fix: code cleaning after review
damcou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore | ||
|
||
composer.phar | ||
/vendor/ | ||
|
||
# php-cs-fixer cache | ||
.php_cs.cache | ||
|
||
# PHPUnit cache | ||
.phpunit.result.cache | ||
|
||
.openapi-generator/ | ||
composer.lock |
16 changes: 16 additions & 0 deletions
16
clients/algoliasearch-client-php/.openapi-generator-ignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
docs/** | ||
test/** | ||
|
||
.travis.yml | ||
phpunit.xml.dist | ||
README.md | ||
git_push.sh | ||
.php_cs | ||
|
||
lib/HeaderSelector.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
$config = new PhpCsFixer\Config(); | ||
|
||
return $config | ||
->setUsingCache(true) | ||
->setRules([ | ||
'array_syntax' => [ 'syntax' => 'short' ], | ||
'blank_line_after_namespace' => false, | ||
'blank_line_after_opening_tag' => true, | ||
'blank_line_before_statement' => true, | ||
'braces' => false, | ||
'cast_spaces' => true, | ||
'combine_consecutive_unsets' => true, | ||
'echo_tag_syntax' => true, | ||
'general_phpdoc_tag_rename' => true, | ||
'mb_str_functions' => true, | ||
'no_blank_lines_after_class_opening' => true, | ||
'no_empty_phpdoc' => true, | ||
'no_empty_statement' => true, | ||
'no_extra_blank_lines' => true, | ||
'no_multiline_whitespace_around_double_arrow' => true, | ||
'no_short_bool_cast' => true, | ||
'no_trailing_whitespace' => true, | ||
'no_trailing_whitespace_in_comment' => true, | ||
'no_unneeded_control_parentheses' => true, | ||
'no_unreachable_default_argument_value' => true, | ||
'no_unused_imports' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'no_whitespace_before_comma_in_array' => true, | ||
'no_whitespace_in_blank_line' => true, | ||
'normalize_index_brace' => true, | ||
'not_operator_with_space' => false, | ||
'object_operator_without_whitespace' => true, | ||
'ordered_imports' => true, | ||
'phpdoc_annotation_without_dot' => true, | ||
'phpdoc_inline_tag_normalizer' => true, | ||
'phpdoc_order' => true, | ||
'phpdoc_scalar' => true, | ||
'phpdoc_separation' => true, | ||
'phpdoc_single_line_var_spacing' => true, | ||
'phpdoc_tag_type' => true, | ||
'protected_to_private' => true, | ||
'@PSR2' => true, | ||
'short_scalar_cast' => true, | ||
'single_blank_line_at_eof' => false, | ||
'single_blank_line_before_namespace' => true, | ||
'single_quote' => true, | ||
'space_after_semicolon' => true, | ||
'standardize_not_equals' => true, | ||
'strict_comparison' => true, | ||
'strict_param' => true, | ||
'ternary_operator_spaces' => true, | ||
'trailing_comma_in_multiline' => true, | ||
'trim_array_spaces' => true, | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->exclude('test') | ||
->exclude('tests') | ||
->in(__DIR__) | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "algolia/algoliasearch-client-php", | ||
"description": "API powering the features of Algolia.", | ||
"keywords": [ | ||
"openapitools", | ||
"openapi-generator", | ||
"openapi", | ||
"php", | ||
"sdk", | ||
"rest", | ||
"api" | ||
], | ||
"homepage": "https://openapi-generator.tech", | ||
"license": "unlicense", | ||
"authors": [ | ||
{ | ||
"name": "OpenAPI-Generator contributors", | ||
"homepage": "https://openapi-generator.tech" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.3 || ^8.0", | ||
"ext-curl": "*", | ||
"ext-json": "*", | ||
"ext-mbstring": "*", | ||
"guzzlehttp/guzzle": "^7.3", | ||
damcou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"guzzlehttp/psr7": "^2.0", | ||
"psr/http-message": "^1.0", | ||
"psr/log": "^1.0 || ^2.0 || ^3.0", | ||
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^3.5.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { "Algolia\\AlgoliaSearch\\" : "lib/" }, | ||
"files": [ | ||
"lib/Http/Psr7/functions.php" | ||
] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { "Algolia\\AlgoliaSearch\\Test\\" : "test/" } | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?php | ||
|
||
namespace Algolia\AlgoliaSearch; | ||
|
||
use Algolia\AlgoliaSearch\Cache\NullCacheDriver; | ||
use Algolia\AlgoliaSearch\Http\HttpClientInterface; | ||
use Algolia\AlgoliaSearch\Log\DebugLogger; | ||
use Psr\Log\LoggerInterface; | ||
use Psr\SimpleCache\CacheInterface; | ||
|
||
final class Algolia | ||
{ | ||
const VERSION = '1.0.0'; | ||
|
||
/** | ||
* Holds an instance of the simple cache repository (PSR-16). | ||
* | ||
* @var \Psr\SimpleCache\CacheInterface|null | ||
*/ | ||
private static $cache; | ||
|
||
/** | ||
* Holds an instance of the logger (PSR-3). | ||
* | ||
* @var \Psr\Log\LoggerInterface|null | ||
*/ | ||
private static $logger; | ||
|
||
/** | ||
* @var \Algolia\AlgoliaSearch\Http\HttpClientInterface | ||
*/ | ||
private static $httpClient; | ||
|
||
public static function isCacheEnabled() | ||
{ | ||
if (null === self::$cache) { | ||
return false; | ||
} | ||
|
||
return !self::getCache() instanceof NullCacheDriver; | ||
} | ||
|
||
/** | ||
* Gets the cache instance. | ||
* | ||
* @return \Psr\SimpleCache\CacheInterface | ||
*/ | ||
public static function getCache() | ||
{ | ||
if (null === self::$cache) { | ||
self::setCache(new NullCacheDriver()); | ||
} | ||
|
||
return self::$cache; | ||
} | ||
|
||
/** | ||
* Sets the cache instance. | ||
*/ | ||
public static function setCache(CacheInterface $cache) | ||
{ | ||
self::$cache = $cache; | ||
} | ||
|
||
/** | ||
* Gets the logger instance. | ||
* | ||
* @return \Psr\Log\LoggerInterface | ||
*/ | ||
public static function getLogger() | ||
{ | ||
if (null === self::$logger) { | ||
self::setLogger(new DebugLogger()); | ||
} | ||
|
||
return self::$logger; | ||
} | ||
|
||
/** | ||
* Sets the logger instance. | ||
*/ | ||
public static function setLogger(LoggerInterface $logger) | ||
{ | ||
self::$logger = $logger; | ||
} | ||
|
||
public static function getHttpClient() | ||
{ | ||
if (null === self::$httpClient) { | ||
self::setHttpClient(new \Algolia\AlgoliaSearch\Http\GuzzleHttpClient()); | ||
} | ||
|
||
return self::$httpClient; | ||
} | ||
|
||
public static function setHttpClient(HttpClientInterface $httpClient) | ||
{ | ||
self::$httpClient = $httpClient; | ||
} | ||
|
||
public static function resetHttpClient() | ||
{ | ||
self::$httpClient = null; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.