承接 ahsan/printify-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ahsan/printify-laravel

最新稳定版本:v1.0.0

Composer 安装命令:

composer require ahsan/printify-laravel

包简介

A Laravel package for interacting with the Printify API.

README 文档

README

Latest Stable Version Total Downloads License

A simple and elegant Laravel package for interacting with the Printify API. This package provides a clean and straightforward way to integrate your Laravel application with Printify, allowing you to manage shops, products, and orders with ease.

Features

  • Easy to install and configure.
  • A simple, intuitive API for interacting with Printify.
  • Fetch shops, products, and orders.
  • Add new products to your shops.
  • Well-documented and supported.

Installation

You can install the package via Composer:

composer require ahsan/printify-laravel

Configuration

Publish the configuration file using the following command:

php artisan vendor:publish --provider="Ahsan\PrintifyLaravel\PrintifyServiceProvider" --tag="config"

This will create a config/printify.php file in your project.

Next, add your Printify API token to your .env file:

PRINTIFY_API_TOKEN=your-api-token

Usage

You can use the PrintifyService class to interact with the Printify API.

Create a PrintifyService Instance

use Ahsan\PrintifyLaravel\PrintifyService;

// You can create an instance directly
$printify = new PrintifyService('your-api-token');

// Or use the service container
$printify = app(PrintifyService::class);

Set the Shop ID

Before you can fetch products or orders, you need to set the shop ID.

$printify->setShopId(123);

Available Methods

Here are the available methods you can use:

Shops

  • getShops(): Fetch all of your shops.
$shops = $printify->getShops();

Products

  • getProducts(): Fetch all products for the currently set shop.
  • addProduct(array $payload): Add a new product to the currently set shop.
// Fetch products
$products = $printify->getProducts();

// Add a new product
$payload = [
    "title" => "My new product",
    "description" => "Best product ever",
    "blueprint_id" => 1,
    "print_provider_id" => 1,
    "variants" => [
        [
            "id" => 1,
            "price" => 2000,
            "is_enabled" => true
        ]
    ],
    "print_areas" => [
        [
            "variant_ids" => [1],
            "placeholders" => [
                [
                    "position" => "front",
                    "images" => [
                        [
                            "id" => "5d5d5d5d5d5d5d5d5d5d5d5d",
                            "x" => 0.5,
                            "y" => 0.5,
                            "scale" => 1,
                            "angle" => 0
                        ]
                    ]
                ]
            ]
        ]
    ]
];

$product = $printify->addProduct($payload);

Orders

  • getOrders(): Fetch all orders for the currently set shop.
$orders = $printify->getOrders();

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

License

The MIT License (MIT). Please see License File for more information.

Support

Buy Me a Coffee

Author

统计信息

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

GitHub 信息

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

其他信息

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