jahid / autodesk-forge
this is a package for autodesk forge process management
Requires
- ext-curl: *
This package is auto-updated.
Last update: 2025-05-05 11:20:13 UTC
README
Overview
This PHP SDK enables you to easily integrate the Forge REST APIs into your application, including OAuth, Data Management, Model Derivative, and Design Automation.
Requirements
- PHP version 8.1 and above.
- A registered app on the Forge Developer portal.
Installation
Composer
To install the bindings via Composer, run:
composer require jahid/autodesk-forge
Vendor publish
Run command
php artisan vendor:publish
Then publish the AutodeskForgeService
service.
Add those variable in .env
AUTODESK_FORGE_CLIENT_ID= AUTODESK_FORGE_CLIENT_SECRET= AUTODESK_PROJECT= #need only for Autodesk 360 AUTODESK_SCOPE= #i.e. "bucket:read,bucket:create,bucket:delete,data:create,account:read,account:write,data:write,data:read,code:all"
Tutorial
Follow this tutorial to see a step-by-step authentication guide, and examples of how to use the Forge APIs.
Create an App
Create an app on the Forge Developer portal. Note the client ID and client secret.
Authentication
This SDK comes with an OAuth 2.0 client that allows you to retrieve 2-legged tokens. The tutorial uses 2-legged tokens for calling different Data Management endpoints.
2-Legged Token
This type of token is given directly to the application.
To get a 2-legged token run the following code. There have an optional parameter (bool $isSetSession) also. If you send true
then it save the token in session. If you do not send any parameter or send false
parameter then it not store the token in session.
(new AutodeskForge\service\AutodeskForgeService)->getToken()
Note:
If you set the token then you can also access to token as like this Session::get('autodeskForgeToken')
. But we recommend to use (new AutodeskForge\service\AutodeskForgeService)->getToken(true)
this process;
API Documentation
You can get the full documentation for the API on the Developer Portal
Documentation for API Endpoints
All URIs are relative to https://developer.api.autodesk.com. For example, the createActivity URI is 'https://developer.api.autodesk.com/autocad.io/us-east/v2/Activities'.
Method | Parameter | Description |
---|---|---|
getToken | optional $isSetSession => bool |
Get authentication token. If you send $isSetSession parameter value true , then it store the token in session. So application not sent api request for every time for token. |
createBucket | optional $policyKey => string (persistent, transient, temporary)optional $bucketKey => string |
Create a bucket |
getBuckets | get bucket list | |
getBucketDetails | bucketKey | get bucket details |
deleteBucket | bucketKey | delete bucket details |
upload | path=> string, fileName => string | upload file in s3 bucket. here path is file source path and fileName is which name is use in s3 |
translate | urn => string, fileName => string, type => string (default value svf2 ), views => array (default value ["2d", "3d"] ), compressedUrn => bool (default value false ), region => string (default value us ) |
You find the objectId in upload file response, this is urn. You can translate file for 2d views only, as well 3d views only also you can translate both 2d & 3d ... |
encodeUrn | $urn=> string | this method is used for encode urn |
getManifest (check translate status) | $encodedUrn=> string (objectId is urn, you must encode the urn) |
this method is used for check translate status |
deleteManifest (delete translated file) | $encodedUrn=> string (objectId is urn, you must encode the urn) |
this method is used for delete translated file |
checkTranslateStatus (check translate status) | $encodedUrn=> string (objectId is urn, you must encode the urn) |
this method is used for check translate status |
Future Feature
- Upload file in Autodesk 3600
Support
Please open an issue on GitHub
License
Create CRUD operation for Laravel application under the MIT license.