Skip to content

Commit

Permalink
优化setDefaultOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
wish-cloud committed Feb 25, 2023
1 parent d25d917 commit 5190719
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 41 deletions.
24 changes: 19 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
.directory
.DS_Store
Thumbs.db
*.sh
.idea

# composer
composer.phar
/vendor/
/.idea/
composer.lock
/vendor

# cs
.php_cs
/.php_cs.cache

# phpunit
/.phpunit.result.cache

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
# test runtime files
/tests/tmp
/tests/sitema*.xml
/tests/sitema*.xml.gz
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 HanSon
Copyright (c) 2023 wish-cloud

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
25 changes: 6 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
# foundation-sdk
To create a sdk easiler!

[![Latest Stable Version](https://poser.pugx.org/hanson/foundation-sdk/v/stable)](https://packagist.org/packages/hanson/foundation-sdk)
[![Total Downloads](https://poser.pugx.org/hanson/foundation-sdk/downloads)](https://packagist.org/packages/hanson/foundation-sdk)
[![Latest Unstable Version](https://poser.pugx.org/hanson/foundation-sdk/v/unstable)](https://packagist.org/packages/hanson/foundation-sdk)
[![License](https://poser.pugx.org/hanson/foundation-sdk/license)](https://packagist.org/packages/hanson/foundation-sdk)
[![Monthly Downloads](https://poser.pugx.org/hanson/foundation-sdk/d/monthly)](https://packagist.org/packages/hanson/foundation-sdk)
[![Daily Downloads](https://poser.pugx.org/hanson/foundation-sdk/d/daily)](https://packagist.org/packages/hanson/foundation-sdk)
## Installation

## What's inside Foundation-sdk
```bash
composer require wish-cloud/foundation-sdk
```

- [pimple](https://github.com/silexphp/Pimple) (Container)
- Http
- Log
## License

## 安装要求

php 7 以上(需要PHP5的可移步到其他人维护的仓库 https://github.com/CodeNauhc/foundation-sdk/tree/php5)

## 中文实例教程

[SDK 开发高级版!揭开 Foundation-SDK 的神秘面纱](https://learnku.com/articles/15038/sdk-development-advanced-edition-uncover-the-mysterious-veil-of-foundation-sdk)

[干货!手把手教你写 SDK !](https://learnku.com/articles/14995/dried-food-hand-in-hand-to-teach-you-to-write-sdk)
This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
17 changes: 11 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
{
"name": "hanson/foundation-sdk",
"name": "wish-cloud/foundation-sdk",
"license": "MIT",
"authors": [
{
"name": "HanSon",
"email": "[email protected]"
"name": "Wish",
"email": "[email protected]"
}
],
"support": {
"issues": "https://github.com/wish-cloud/foundation-sdk/issues",
"source": "https://github.com/wish-cloud/foundation-sdk"
},
"require": {
"php": "^7.0|^8.0",
"pimple/pimple": "^3.0",
"doctrine/cache": "^1.6",
"symfony/http-foundation": "^3.3|^4.0|^5.0|^6.0",
"guzzlehttp/guzzle": "^6.2|^7.0",
"monolog/monolog": "^1.22|^2.0",
"monolog/monolog": "^2.0|^3.0",
"ext-curl": "*"
},
"autoload": {
"psr-4": {
"Hanson\\Foundation\\": "src/"
"WishCloud\\Foundation\\": "src/"
}
},
"require-dev": {
"phpunit/phpunit": "^9.3"
}
},
"version": "1.0.1"
}
2 changes: 1 addition & 1 deletion src/AbstractAPI.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Hanson\Foundation;
namespace WishCloud\Foundation;

use Psr\Http\Message\RequestInterface;

Expand Down
2 changes: 1 addition & 1 deletion src/AbstractAccessToken.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Hanson\Foundation;
namespace WishCloud\Foundation;

use Doctrine\Common\Cache\Cache;
use Doctrine\Common\Cache\FilesystemCache;
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/HttpException.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


namespace Hanson\Foundation\Exception;
namespace WishCloud\Foundation\Exception;

use Exception;

Expand Down
4 changes: 2 additions & 2 deletions src/Foundation.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


namespace Hanson\Foundation;
namespace WishCloud\Foundation;


use Doctrine\Common\Cache\Cache;
Expand All @@ -16,7 +16,7 @@
/**
* Class Foundation
* @property-read Http $http
* @package Hanson\Foundation
* @package WishCloud\Foundation
*/
class Foundation extends Container
{
Expand Down
7 changes: 5 additions & 2 deletions src/Http.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Hanson\Foundation;
namespace WishCloud\Foundation;

use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\HandlerStack;
use Hanson\Foundation\Exception\HttpException;
use WishCloud\Foundation\Exception\HttpException;
use Psr\Http\Message\ResponseInterface;

/**
Expand Down Expand Up @@ -52,6 +52,9 @@ class Http
*/
public static function setDefaultOptions($defaults = [])
{
if(!isset($defaults['curl'])){
$defaults['curl'] = [CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4];
}
self::$defaults = $defaults;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Log.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Hanson\Foundation;
namespace WishCloud\Foundation;

use Monolog\Handler\ErrorLogHandler;
use Monolog\Handler\NullHandler;
Expand Down
3 changes: 1 addition & 2 deletions tests/HttpTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Hanson\Foundation;
namespace WishCloud\Foundation;

use GuzzleHttp\Handler\MockHandler;
use PHPUnit\Framework\TestCase;
Expand All @@ -16,4 +16,3 @@ public function testAddHandler()
var_dump($stack);
}
}

0 comments on commit 5190719

Please sign in to comment.