Skip to content

Commit

Permalink
初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
LaJun committed Jan 2, 2021
1 parent 479326a commit b099cfd
Show file tree
Hide file tree
Showing 12 changed files with 470 additions and 2 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

[*.{vue,js,scss}]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto

/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
phpunit.php export-ignore
phpunit.xml.dist export-ignore
phpunit.xml export-ignore
.php_cs export-ignore
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.idea
*.DS_Store
/vendor
/coverage
sftp-config.json
composer.lock
.subsplit
.php_cs.cache
index.php
27 changes: 27 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
$header = <<<EOF
This file is part of the onecoder/easytaoke.
(c) LaJun <[email protected]>
This source file is subject to the MIT license that is bundled.
EOF;

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules(array(
'@Symfony' => true,
'header_comment' => array('header' => $header),
'array_syntax' => array('syntax' => 'short'),
'ordered_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'php_unit_construct' => true,
'php_unit_strict' => true,
))
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
)
;
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
# TaoKeSdk
简单易用的多平台淘客SDK,灵活性强,扩展性。
<h1 align="center"> EasyTaoKe </h1>

<p align="center"> 致力于最简单易用,最全的PHP淘客SDK.</p>


## Composer安装

```shell
$ composer require onecoder/easytaoke -vvv
```

## 用法

```php

$config = [
'key' => '', //美团联盟key
'secret' => '', //美团联盟secret
'callback_secret' => '', //美团联盟callback_secret
];

//实例化美团联盟应用
$meiTuanUnion = \OneCoder\EasyTaoKe\Factory::meiTuanUnion($config);
$startTime = time() - 24 * 60 * 60;
$endTime = time();

//获取美团联盟订单
$data = $meiTuanUnion->getOrderList($startTime, $endTime);

//回调验证,返回true验证通过
$callBackResult = $meiTuanUnion->validateCallback($params);
```

## 贡献

欢迎广大PHPer一起加入淘客CPS SDK开发,致力于最完善易用的开源 SDK, 一起来PR

## 开源协议

MIT
19 changes: 19 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "onecoder\/easytaoke",
"description": "最简单易用,最全的PHP淘客SDK",
"license": "MIT",
"authors": [
{
"name": "LaJun",
"email": "[email protected]"
}
],
"require": {
"guzzlehttp/guzzle": "^7.2"
},
"autoload": {
"psr-4": {
"OneCoder\\EasyTaoKe\\": "src"
}
}
}
21 changes: 21 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>
Empty file added src/.gitkeep
Empty file.
18 changes: 18 additions & 0 deletions src/Base/Application.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* 2021年01月02日 23:32
*/

namespace OneCoder\EasyTaoKe\Base;

/***
*
* 基础应用类
* Class Application
*
* @package OneCoder\EasyTaoKe\Base
*/
class Application
{

}
48 changes: 48 additions & 0 deletions src/Factory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* 2021年01月02日 14:33
*/

/*
* This file is part of the onecoder/easytaoke.
*
* (c) LaJun <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace OneCoder\EasyTaoKe;

/**
* Class Factory.
*/
class Factory
{
/**
* @param string $name
* @param array $config
*
* @return \EasyWeChat\Kernel\ServiceContainer
*/
public static function make($name, array $config)
{
$namespace = ucwords($name);
$application = "\\OneCoder\\EasyTaoKe\\{$namespace}\\Application";

return new $application($config);
}

/**
* Dynamically pass methods to the application.
*
* @param string $name
* @param array $arguments
*
* @return mixed
*/
public static function __callStatic($name, $arguments)
{
return self::make($name, ...$arguments);
}
}
Loading

0 comments on commit b099cfd

Please sign in to comment.