abbadon1334/laravel-apify
Composer 安装命令:
composer require abbadon1334/laravel-apify
包简介
A Laravel package that provides a convenient interface for integrating with the Apify web scraping and automation platform
关键字:
README 文档
README
A Laravel package for integrating with the Apify web scraping and automation platform.
Installation
Install the package via Composer:
composer require flatroy/laravel-apify
The package will automatically register its service provider and facade.
Configuration
Publish the configuration file:
php artisan vendor:publish --tag=apify-config
Add your Apify API token to your .env file:
APIFY_API_TOKEN=your_apify_api_token_here
You can find your API token in your Apify account settings.
Usage
Using the Facade
use Apify\Laravel\Facades\Apify; // Run an actor $result = Apify::runActor('actor-id', [ 'url' => 'https://example.com' ], [ 'waitForFinish' => 60 ]); // Get dataset results $data = Apify::getDataset('dataset-id'); // Get user information $user = Apify::getUser();
Using Dependency Injection
use Apify\Laravel\ApifyClient; class ScrapingService { public function __construct(private ApifyClient $apify) { } public function scrapeWebsite(string $url): array { return $this->apify->runActor('web-scraper', [ 'url' => $url ]); } }
Available Methods
Running Actors
// Run an actor and wait for completion $result = Apify::runActor('actor-id', $input, [ 'waitForFinish' => 60, // seconds 'memory' => 512, // MB ]); // Run without waiting $result = Apify::runActor('actor-id', $input, [ 'waitForFinish' => 0 ]);
Working with Datasets
// Get all items from a dataset $items = Apify::getDataset('dataset-id'); // Get items with pagination $items = Apify::getDataset('dataset-id', [ 'limit' => 100, 'offset' => 200 ]); // Get specific fields only $items = Apify::getDataset('dataset-id', [ 'fields' => ['title', 'url', 'price'] ]);
Key-Value Stores
// Get a record from key-value store $record = Apify::getKeyValueStore('store-id', 'record-key'); // Set a record in key-value store Apify::setKeyValueStore('store-id', 'record-key', [ 'data' => 'value' ]); // Store binary data Apify::setKeyValueStore('store-id', 'image.jpg', $binaryData, 'image/jpeg');
Actor Runs Management
// Get actor run details $run = Apify::getActorRun('run-id'); // Abort a running actor $result = Apify::abortActorRun('run-id');
Listing Actors
// List all available actors $actors = Apify::listActors(); // List only your actors $myActors = Apify::listActors(['my' => true]); // Paginated listing $actors = Apify::listActors([ 'limit' => 50, 'offset' => 100 ]);
Error Handling
The package throws ApifyException for API errors:
use Apify\Laravel\ApifyException; try { $result = Apify::runActor('invalid-actor-id'); } catch (ApifyException $e) { Log::error('Apify error: ' . $e->getMessage()); }
Configuration Options
The configuration file (config/apify.php) includes:
api_token: Your Apify API tokenbase_uri: API base URL (default: https://api.apify.com/v2/)timeout: Request timeout in seconds (default: 30)default_actor_options: Default options for running actorswebhook_url: URL for webhook notificationswebhook_events: Events to receive webhooks for
Testing
composer test
License
The MIT License (MIT). Please see License File for more information.
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security related issues, please email security@apify.com instead of using the issue tracker.
abbadon1334/laravel-apify 适用场景与选型建议
abbadon1334/laravel-apify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.34k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「laravel」 「automation」 「apify」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 abbadon1334/laravel-apify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 abbadon1334/laravel-apify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 abbadon1334/laravel-apify 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Command-line utility for Vtiger CRM.
Historical accounting for contacts
Extends Mautic Lead Bundle's Lead List (Segment) functionality.
A PHP code checks automation tool that can be used as git pre-commit hook.
Vultr PHP API
统计信息
- 总下载量: 5.34k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-29