monthly-cloud/monthly-sdk-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

monthly-cloud/monthly-sdk-laravel

最新稳定版本:0.8.4

Composer 安装命令:

composer require monthly-cloud/monthly-sdk-laravel

包简介

Laravel SDK for monthly.cloud.

README 文档

README

Laravel SDK used to connect with monthly cloud.

Installation

composer require monthly-cloud/monthly-sdk-laravel

Add Monthly Cloud service provider and alias to your config/app.php config:

'providers' => [
    ...
    MonthlyCloud\Laravel\MonthlyCloudServiceProvider::class,
],
'aliases' => [
    ...
    'MonthlyCloud' => MonthlyCloud\Laravel\MonthlyCloud::class,
    'MonthlyStorage' => MonthlyCloud\Laravel\MonthlyStorage::class,
],

Configuration

To create configuration file run:

php artisan vendor:publish --provider="MonthlyCloud\Laravel\MonthlyCloudServiceProvider"

In oprder to access cloud API update .env file MONTHLY_CLOUD_ACCESS_TOKEN variable or config/monthlycloud.php access_token with access token generated in cloud settings.

To use Monthly Storage set MONTHLY_CLOUD_WEBSITE_ID and MONTHLY_CLOUD_LISTING_ID.

Usage

Example usage of Monthly Cloud sdk:

$property = MonthlyCloud::endpoint('properties')->find(1); // Single property
$properties = MonthlyCloud::endpoint('properties')->get(); // List of properties

Example usage of Monthly Storage sdk:

MonthlyStorage::endpoint('routes')->get(); // get routes using default app language
MonthlyStorage::endpoint('menus')->locale('en')->get(); // get menus in pre-defined language
MonthlyStorage::endpoint('contents')->find(31); // find content
MonthlyStorage::endpoint('contents')->website(3)->id(31)->buildUrl(); // build file url for specific website and content id

MonthlyStorage::getListingItem()->find(100); // find listing item
MonthlyStorage::findContent(1); // quick way to find content
MonthlyStorage::getRoutes('en'); // quick way to access routes

Example usage of Translation Service:

/**
 * Get key from translations dictionary.
 *
 * @param string|null $key
 * @return string|array
 */
function __t($key = null)
{
	if (empty($key)) {
		return app(\MonthlyCloud\Laravel\Services\TranslationService::class)->getTranslations();
	}

	return app(\MonthlyCloud\Laravel\Services\TranslationService::class)->translate($key);
}

User log-in

Monthly Cloud is compatible with Laravel Authentication.

You can setup authentication by running:

php artisan make:auth
php artisan migrate

Setup cloud provider in auth.php:

    'guards' => [
        'web' => [
            ...
            'provider' => 'cloud',
        ],
    ...
    'providers' => [
        'cloud' => [
            'driver' => 'cloud',
            'model' => App\User::class,
        ],
        ...
    ],

Add IsMonthlyCloudUser trait to User model. By default it will store cloud "label" in $user->name and save it in database.

If you need more information in local database check applyUserData method in IsMonthlyCloudUser trait.

统计信息

  • 总下载量: 3.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固