sohead / core
Sohead的核心包,支持laravel 5.8
此包的官方仓库似乎已不存在,因此该包已被冻结。
v1.2.9
2020-08-07 05:01 UTC
Requires
- abraham/twitteroauth: ^1.1
- facebook/graph-sdk: ^5.7
- facebook/php-business-sdk: 3.1.*
- firebase/php-jwt: ^5.0
- gmostafa/php-graphql-client: ^1.4
- google/apiclient: ^2.0
- guzzlehttp/guzzle: ^6.5
- dev-master
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.9
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-rating
- dev-sohead_admin_es
- dev-develop
- dev-social_shop
- dev-new_widget_function
- dev-intagram
- dev-user_info
- dev-fix_customer_shopify
- dev-newprice
- dev-social_publish
- dev-hackathong
- dev-add_test_env
- dev-remove_app_version_check
- dev-fix_schedule
- dev-handle-shop-update
This package is auto-updated.
Last update: 2020-11-12 04:49:28 UTC
README
安装
composer require sohead/core
配置
为API设置中间件cors
将中间件添加到Kernel的$middleware中
protected $middleware = [ ... \Sohead\Core\Http\Middleware\Cors::class, ]
发布配置文件
php artisan vendor:publish --provider="Sohead\Core\SoheadProvider"
添加数据库配置
将配置添加到config/database
'connections' => [ ... 'sohead_core' => [ 'driver' => 'pgsql', 'url' => env('DATABASE_URL'), 'host' => env('DB_CORE_HOST', '127.0.0.1'), 'port' => env('DB_CORE_PORT', '5432'), 'database' => env('DB_CORE_DATABASE', 'forge'), 'username' => env('DB_CORE_USERNAME', 'forge'), 'password' => env('DB_CORE_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, 'schema' => 'public', 'sslmode' => 'prefer', ], ]
将配置添加到.env文件
APP_ID= FRONTEND_URL= DB_CORE_HOST= DB_CORE_PORT= DB_CORE_DATABASE= DB_CORE_USERNAME= DB_CORE_PASSWORD= SPF_API_KEY= SPF_SECRET_KEY= FACEBOOK_KEY= FACEBOOK_SECRET= GOOGLE_KEY= GOOGLE_SECRET=
将任务调度添加到Kernel中的function schedule
$schedule->command('shopify:sync_collection_product')->everyFiveMinutes();
如何使用
已识别路由
方法 | URI | 操作 | 中间件 |
---|---|---|---|
GET | api/app/user | Sohead\Core\Http\Controllers\Api\AppController@userInfo | sohead.auth |
GET | api/shopify/auth_handle | Sohead\Core\Http\Controllers\Api\ShopifyController@auth | |
POST | api/shopify/charge | Sohead\Core\Http\Controllers\Api\ShopifyController@charge | sohead.auth |
GET | api/shopify/charge_handle | Sohead\Core\Http\Controllers\Api\ShopifyController@chargeHandle | |
POST | api/shopify/generate_url | Sohead\Core\Http\Controllers\Api\ShopifyController@getAuthUrl | |
POST | api/shopify/webhook | Sohead\Core\Http\Controllers\Api\ShopifyController@webhook | shopify.webhook |
POST | api/social/account | Sohead\Core\Http\Controllers\Api\SocialController@saveAccount | sohead.auth |
GET | api/social/auth_handle | Sohead\Core\Http\Controllers\Api\SocialController@authHandle | sohead.redirect |
POST | api/social/generate_url | Sohead\Core\Http\Controllers\Api\SocialController@getAuthUrl | sohead.auth |
GET | api/social/previewMetaData | Sohead\Core\Http\Controllers\Api\SocialController@previewMetaData | |
POST | api/social/re-auth | Sohead\Core\Http\Controllers\Api\SocialController@reconnect | sohead.auth |
社交支持
中间件
- sohead.auth : 检查授权
- shopify.webhook : Shopify身份验证钩子
队列
- 添加Webhook (init_app)
- 同步产品 (shopify_sync_products)
- 同步集合 (shopify_sync_collections)
- 同步集合产品 (shopify_sync_collection_product)
如何自定义
应用安装Shopify处理授权
在AppServiceProvider的function boot中添加单例
$this->app->singleton( \Sohead\Core\Services\Contracts\AppService::class, \App\Services\AppService::class );
文件AppService需要扩展类core
\Sohead\Core\Services\AppService
然后您可以自定义逻辑函数
收费处理
创建Charge Handle监听器 文档
php artisan make:listener ChargeHandle
将监听器添加到EventServiceProvider的$listen中
protected $listen = [ ... \Sohead\Core\Events\ChargeHandle::class => [ \App\Listeners\ChargeHandle::class, ], ];
然后您可以自定义逻辑Charge Handle
Shopify钩子
创建ShopifyHook监听器 文档
php artisan make:listener ShopifyHook
将监听器添加到EventServiceProvider的$listen中
protected $listen = [ ... \Sohead\Core\Events\ShopifyHook::class => [ \App\Listeners\ShopifyHook::class, ], ];
然后您可以自定义逻辑wehhook
API社交
在AppServiceProvider的function boot中添加单例
$this->app->singleton( \Sohead\Core\Services\Contracts\SocialService::class, \App\Services\SocialService::class );
文件SocialService需要扩展类core
\Sohead\Core\Services\SocialService
然后您可以自定义逻辑函数