asciisd/autochartist-laravel 问题修复 & 功能扩展

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

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

asciisd/autochartist-laravel

最新稳定版本:v2.0.0

Composer 安装命令:

composer require asciisd/autochartist-laravel

包简介

Autochartist API integration with Laravel

README 文档

README

Latest Version on Packagist Total Downloads License

A lightweight Laravel integration for the Autochartist API. It handles request authentication for you and exposes a simple, fluent way to fetch technical analysis data.

Requirements

  • PHP ^8.1
  • Laravel 10, 11, 12, or 13

Installation

Install the package via Composer:

composer require asciisd/autochartist-laravel

The service provider and the Autochartist facade are registered automatically through Laravel package discovery.

Publishing the Config File

Publish the configuration file to your application's config directory:

php artisan vendor:publish --tag=autochartist-config

This creates config/autochartist.php, where all values are read from your environment.

Environment Variables

Add the following keys to your Laravel project's .env file:

AUTOCHARTIST_URL=https://api.autochartist.com/
AUTOCHARTIST_BROKER_ID=your-broker-id
AUTOCHARTIST_SECRET_KEY=your-secret-key
AUTOCHARTIST_ACCOUNT_TYPE=demo
AUTOCHARTIST_TOKEN_TTL=259200
Variable Required Description
AUTOCHARTIST_URL No Base URL for all API requests. Defaults to https://api.autochartist.com/.
AUTOCHARTIST_BROKER_ID Yes Your customer (broker) ID on Autochartist's systems.
AUTOCHARTIST_SECRET_KEY Yes The secret used to sign the request token. Keep this private.
AUTOCHARTIST_ACCOUNT_TYPE No demo or live. Defaults to demo.
AUTOCHARTIST_TOKEN_TTL No How long (in seconds) a generated token stays valid. Defaults to 259200 (3 days).

Usage

Fetching Technical Trade Setups

Use the Autochartist facade to reach the Technical Analysis service and call technicalTradeSetups(). It returns the API response decoded into a PHP array (JSON data):

use Asciisd\AutochartistLaravel\Facades\Autochartist;

$setups = Autochartist::technicalAnalysis()->technicalTradeSetups();

return response()->json($setups);

You can pass a query array to filter the results:

use Asciisd\AutochartistLaravel\Facades\Autochartist;

$setups = Autochartist::technicalAnalysis()->technicalTradeSetups([
    'group' => 'Currencies',
]);

You may also resolve the service from the container instead of using the facade:

use Asciisd\AutochartistLaravel\Services\AutochartistManager;

$setups = app(AutochartistManager::class)
    ->technicalAnalysis()
    ->technicalTradeSetups();

Authentication Requirement

Autochartist credentials are generated per authenticated user (the request token is bound to the user's email). Calls must therefore run within an authenticated context, for example inside a route protected by the auth middleware:

use Asciisd\AutochartistLaravel\Facades\Autochartist;
use Illuminate\Support\Facades\Route;

Route::middleware('auth')->get('/trade-setups', function () {
    return Autochartist::technicalAnalysis()->technicalTradeSetups();
});

If no user is authenticated, or if the secret key is missing, an Asciisd\AutochartistLaravel\Exceptions\AutochartistException is thrown.

License

This package is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固