manulith/sketchfab-php

一个用于上传3D对象到Sketchfab API的Laravel包。

v0.1.0 2014-07-14 14:53 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:21:57 UTC


README

这是一个用于上传3D对象到Sketchfab API的Laravel包。

安装

  1. "manulith/sketchfab-php": "dev-master" 添加到 composer.json 文件中。
  2. 运行 composer update
  3. 发布你的配置
$ php artisan vendor:publish"

然后,在 config/sketchfab.php 中设置你的API密钥

使用方法

上传一个对象

简单

<?php
$file = '/path/to/file.stl';
$response = Sketchfab::upload($file);
echo $response['uid'];

带有可选参数

<?php
$file = '/path/to/file.stl';
$options = array(
    'name'        => 'My awesome object',
    'description' => 'This is just a test file.',
    'tags'        => 'awesome fun',
    'private'     => true,
    'password'    => 'letmein',
);
$response = Sketchfab::upload($file, $options);
echo $response['uid'];

检查对象的状况

<?php
$response = Sketchfab::status('cnTC9viItfZ1fdT811NgEVafw1S');
echo $response['processing'];

获取对象的oEmbed信息

<?php
$response = Sketchfab::info('cnTC9viItfZ1fdT811NgEVafw1S');
print_r($response);

嵌入一个对象

简单

<?php
echo Sketchfab::embed('cnTC9viItfZ1fdT811NgEVafw1S');

带有可选参数

<?php
$options = array(
    'width'       => 320, // or '100%'
    'height'      => 280,
    'ui_infos'    => 1,
    'ui_controls' => 1,
    'ui_stop'     => 1,
    'autostart'   => 1,
);
echo Sketchfab::embed('cnTC9viItfZ1fdT811NgEVafw1S');