Caution
This project is currently in Beta, meaning features and APIs may evolve over time.
Please report bugs or request new features by creating a GitHub issue.
The official Upsun SDK for PHP. This SDK provides a PHP interface that maps to the Upsun CLI commands. For more information, read the documentation.
Install the SDK via Composer:
composer require upsun/upsun-sdk-phpThen include Composer's autoloader in your PHP application:
require __DIR__ . '/vendor/autoload.php';You will need an Upsun API token to use this SDK. Store it securely, preferably in an environment variable.
use Upsun\UpsunConfig;
use Upsun\UpsunClient;
$config = new UpsunConfig(apiToken: getenv('UPSUN_API_TOKEN'));
$client = new UpsunClient($config);$organizations = $client->organizations->list();$projects = $client->organizations->listProjects('<organizationId>');$project = $client->projects->get('<projectId>');$project = $client->projects->create(
<organizationId>,
[
'projectTitle' => 'Project title',
'projectRegion' => 'eu-5.platform.sh',
'defaultBranch' => 'main',
]
);$projectData = [
'title' => 'title',
'description' => 'description'
];
$response = $client->projects->update(<projectId>, $projectData);$client->projects->delete(<projectId>);Clone the repository and install dependencies:
git clone git@github.com:upsun/upsun-sdk-php.git
composer installThe SDK is built as follows:
- From the JSON specs of our API
- Using
@openapitools/openapi-generator-cli - Which generates:
- PHP Models (in
src/Model/) - PHP APIs (in
src/Api/)
- PHP Models (in
- Higher-level PHP Tasks (in
src/Tasks/)
API and Model classes are generated using openapi-generator-cli from the Upsun OpenAPI spec.
npm install @openapitools/openapi-generator-cli --save-dev
php templates/pre-processing/preprocess-schema.php
npx openapi-generator-cli generate -c templates/php/config.yaml
composer run fix
composer run rectorContributions are welcome!
Please open a pull request or an issue
for any improvements, bug fixes, or new features.
All URIs are relative to https://api.upsun.com
- AListOfFilesToAddToTheRepositoryDuringInitializationInner
- APIToken
- AcceptedResponse
- AccessControlDefinitionForThisEnviromentInner
- Activity
- Address
- AddressGrantsInner
- AddressMetadata
- AddressMetadataMetadata
- Alert
- ApplyOrgVoucherRequest
- ArrayFilter
- AutoscalerAlertPartial
- AutoscalerCPUPressureTrigger
- AutoscalerCPUResources
- AutoscalerCPUTrigger
- AutoscalerCondition
- AutoscalerDuration
- AutoscalerInstances
- AutoscalerMemoryPressureTrigger
- AutoscalerMemoryResources
- AutoscalerMemoryTrigger
- AutoscalerResources
- AutoscalerScalingCooldown
- AutoscalerScalingFactor
- AutoscalerServiceSettings
- AutoscalerSettings
- AutoscalerTriggers
- Autoscaling
- Backup
- BitbucketIntegration
- BitbucketIntegrationConfigurations
- BitbucketIntegrationCreateInput
- BitbucketIntegrationPatch
- BitbucketServerIntegration
- BitbucketServerIntegrationConfigurations
- BitbucketServerIntegrationCreateInput
- BitbucketServerIntegrationPatch
- BlackfireEnvironmentsCredentialsValue
- BlackfireIntegration
- BlackfireIntegrationConfigurations
- BlackfireIntegrationCreateInput
- BlackfireIntegrationPatch
- Blob
- BuildResources
- BuildResources1
- BuildResources2
- CacheConfiguration
- CanCreateNewOrgSubscription200Response
- CanCreateNewOrgSubscription200ResponseRequiredAction
- CanUpdateSubscription200Response
- Certificate
- CertificateCreateInput
- CertificatePatch
- CertificateProvisioner
- CertificateProvisionerPatch
- CommandsInner
- CommandsToManageTheApplicationSLifecycle
- Commit
- Components
- Config
- ConfigurationAboutTheTrafficRoutedToThisVersion
- ConfigurationAboutTheTrafficRoutedToThisVersion1
- ConfigurationForAccessingThisApplicationViaHTTP
- ConfigurationForPreFlightChecks
- ConfigurationForSupportingRequestBuffering
- ConfigurationOfAWorkerContainerInstance
- ConfigurationOnHowTheWebServerCommunicatesWithTheApplication
- ConfigurationRelatedToTheSourceCodeOfTheApplication
- ConfirmPhoneNumberRequest
- ConfirmTotpEnrollment200Response
- ConfirmTotpEnrollmentRequest
- Connection
- ContainerProfilesValueValue
- CreateApiTokenRequest
- CreateAuthorizationCredentials200Response
- CreateAuthorizationCredentials200ResponseRedirectToUrl
- CreateOrgInviteRequest
- CreateOrgMemberRequest
- CreateOrgProjectRequest
- CreateOrgRequest
- CreateOrgSubscriptionRequest
- CreateProfilePicture200Response
- CreateProjectInviteRequest
- CreateProjectInviteRequestEnvironmentsInner
- CreateProjectInviteRequestPermissionsInner
- CreateSshKeyRequest
- CreateTeamMemberRequest
- CreateTeamRequest
- CreateTicketRequest
- CreateTicketRequestAttachmentsInner
- CurrencyAmount
- CurrencyAmountNullable
- CurrentUser
- CurrentUserCurrentTrialInner
- CurrentUserProjectsInner
- CustomDomains
- DataRetention
- DataRetentionConfigurationValue
- DataRetentionConfigurationValue1
- DateTimeFilter
- DedicatedDeploymentTarget
- DedicatedDeploymentTargetCreateInput
- DedicatedDeploymentTargetPatch
- DefaultConfig
- DefaultConfig1
- Deployment
- DeploymentTarget
- DeploymentTargetCreateInput
- DeploymentTargetPatch
- Discount
- DiscountCommitment
- DiscountCommitmentAmount
- DiscountCommitmentNet
- DiscountDiscount
- Domain
- DomainCreateInput
- DomainPatch
- EmailIntegration
- EmailIntegrationCreateInput
- EmailIntegrationPatch
- EnterpriseDeploymentTarget
- EnterpriseDeploymentTargetCreateInput
- EnterpriseDeploymentTargetPatch
- Environment
- EnvironmentActivateInput
- EnvironmentBackupInput
- EnvironmentBranchInput
- EnvironmentDeployInput
- EnvironmentInfo
- EnvironmentInitializeInput
- EnvironmentMergeInput
- EnvironmentOperationInput
- EnvironmentPatch
- EnvironmentRestoreInput
- EnvironmentSourceOperation
- EnvironmentSourceOperationInput
- EnvironmentSynchronizeInput
- EnvironmentType
- EnvironmentVariable
- EnvironmentVariableCreateInput
- EnvironmentVariablePatch
- Error
- EstimationObject
- FastlyCDNIntegrationConfigurations
- FastlyIntegration
- FastlyIntegrationCreateInput
- FastlyIntegrationPatch
- FilesystemMountsOfThisApplicationIfNotSpecifiedTheApplicationWillHaveNoWriteableDiskSpaceValue
- Firewall
- FoundationDeploymentTarget
- FoundationDeploymentTargetCreateInput
- FoundationDeploymentTargetPatch
- GetAddress200Response
- GetCurrentUserVerificationStatus200Response
- GetCurrentUserVerificationStatusFull200Response
- GetOrgPrepaymentInfo200Response
- GetOrgPrepaymentInfo200ResponseLinks
- GetOrgPrepaymentInfo200ResponseLinksSelf
- GetOrgPrepaymentInfo200ResponseLinksTransactions
- GetSubscriptionUsageAlerts200Response
- GetTotpEnrollment200Response
- GetTypeAllowance200Response
- GetTypeAllowance200ResponseCurrencies
- GetTypeAllowance200ResponseCurrenciesAUD
- GetTypeAllowance200ResponseCurrenciesCAD
- GetTypeAllowance200ResponseCurrenciesEUR
- GetTypeAllowance200ResponseCurrenciesGBP
- GetTypeAllowance200ResponseCurrenciesUSD
- GetUsageAlerts200Response
- GitHubIntegrationConfigurations
- GitLabIntegration
- GitLabIntegrationConfigurations
- GitLabIntegrationCreateInput
- GitLabIntegrationPatch
- GitServerConfiguration
- GithubIntegration
- GithubIntegrationCreateInput
- GithubIntegrationPatch
- GoogleSSOConfig
- GrantProjectTeamAccessRequestInner
- GrantProjectUserAccessRequestInner
- GrantTeamProjectAccessRequestInner
- GrantUserProjectAccessRequestInner
- GuaranteedResources
- HTTPLogForwardingIntegrationConfigurations
- HalLinks
- HalLinksNext
- HalLinksPrevious
- HalLinksSelf
- HealthEmailNotificationIntegrationConfigurations
- HealthPagerDutyNotificationIntegrationConfigurations
- HealthSlackNotificationIntegrationConfigurations
- HealthWebHookIntegration
- HealthWebHookIntegrationCreateInput
- HealthWebHookIntegrationPatch
- HealthWebhookNotificationIntegrationConfigurations
- HooksExecutedAtVariousPointInTheLifecycleOfTheApplication
- HttpAccessPermissions
- HttpAccessPermissions1
- HttpLogIntegration
- HttpLogIntegrationCreateInput
- HttpLogIntegrationPatch
- ImagesValueValue
- Integration
- IntegrationCreateInput
- IntegrationPatch
- Integrations
- Invoice
- InvoicePDF
- LineItem
- LineItemComponent
- Link
- ListLinks
- ListOrgDiscounts200Response
- ListOrgInvoices200Response
- ListOrgMembers200Response
- ListOrgOrders200Response
- ListOrgPlanRecords200Response
- ListOrgPrepaymentTransactions200Response
- ListOrgPrepaymentTransactions200ResponseLinks
- ListOrgPrepaymentTransactions200ResponseLinksNext
- ListOrgPrepaymentTransactions200ResponseLinksPrepayment
- ListOrgPrepaymentTransactions200ResponseLinksPrevious
- ListOrgPrepaymentTransactions200ResponseLinksSelf
- ListOrgProjects200Response
- ListOrgSubscriptions200Response
- ListOrgUsageRecords200Response
- ListOrgs200Response
- ListPlans200Response
- ListProfiles200Response
- ListProjectTeamAccess200Response
- ListProjectUserAccess200Response
- ListRegions200Response
- ListTeamMembers200Response
- ListTeams200Response
- ListTicketCategories200ResponseInner
- ListTicketPriorities200ResponseInner
- ListTickets200Response
- ListUserExtendedAccess200Response
- ListUserExtendedAccess200ResponseItemsInner
- ListUserOrgs200Response
- LogsForwarding
- MappingOfClustersToEnterpriseApplicationsValue
- Metrics
- MetricsMetadata
- MetricsValue
- NewRelicIntegration
- NewRelicIntegrationCreateInput
- NewRelicIntegrationPatch
- NewRelicLogForwardingIntegrationConfigurations
- OpenTelemetryLogForwardingIntegrationConfigurations
- OperationsThatCanBeAppliedToTheSourceCodeValue
- OperationsThatCanBeTriggeredOnThisApplicationValue
- Order
- OrderBillingPeriodLabel
- OrderLinks
- OrderLinksInvoices
- Organization
- OrganizationAddonsObject
- OrganizationAddonsObjectAvailable
- OrganizationAddonsObjectCurrent
- OrganizationAddonsObjectUpgradesAvailable
- OrganizationAlertConfig
- OrganizationAlertConfigConfig
- OrganizationAlertConfigConfigThreshold
- OrganizationCarbon
- OrganizationEstimationObject
- OrganizationEstimationObjectSubscriptions
- OrganizationEstimationObjectSubscriptionsListInner
- OrganizationEstimationObjectSubscriptionsListInnerUsage
- OrganizationEstimationObjectUserLicenses
- OrganizationEstimationObjectUserLicensesBase
- OrganizationEstimationObjectUserLicensesBaseList
- OrganizationEstimationObjectUserLicensesBaseListAdminUser
- OrganizationEstimationObjectUserLicensesBaseListViewerUser
- OrganizationEstimationObjectUserLicensesUserManagement
- OrganizationEstimationObjectUserLicensesUserManagementList
- OrganizationEstimationObjectUserLicensesUserManagementListAdvancedManagementUser
- OrganizationEstimationObjectUserLicensesUserManagementListStandardManagementUser
- OrganizationInvitation
- OrganizationInvitationOwner
- OrganizationLinks
- OrganizationLinksAddress
- OrganizationLinksApplyVoucher
- OrganizationLinksCreateMember
- OrganizationLinksCreateSubscription
- OrganizationLinksDelete
- OrganizationLinksEstimateSubscription
- OrganizationLinksMembers
- OrganizationLinksMfaEnforcement
- OrganizationLinksOrders
- OrganizationLinksPaymentSource
- OrganizationLinksProfile
- OrganizationLinksSelf
- OrganizationLinksSubscriptions
- OrganizationLinksUpdate
- OrganizationLinksVouchers
- OrganizationMFAEnforcement
- OrganizationMember
- OrganizationMemberLinks
- OrganizationMemberLinksDelete
- OrganizationMemberLinksSelf
- OrganizationMemberLinksUpdate
- OrganizationProject
- OrganizationProjectCarbon
- OrganizationProjectLinks
- OrganizationProjectLinksActivities
- OrganizationProjectLinksAddons
- OrganizationProjectLinksDelete
- OrganizationProjectLinksSelf
- OrganizationProjectLinksUpdate
- OrganizationReference
- OrganizationSSOConfig
- OutboundFirewall
- OutboundFirewallRestrictionsInner
- OwnerInfo
- PagerDutyIntegration
- PagerDutyIntegrationCreateInput
- PagerDutyIntegrationPatch
- PerServiceResourcesOverridesValue
- Plan
- PlanRecords
- PrepaymentObject
- PrepaymentObjectPrepayment
- PrepaymentObjectPrepaymentBalance
- PrepaymentTransactionObject
- PrepaymentTransactionObjectAmount
- ProdDomainStorage
- ProdDomainStorageCreateInput
- ProdDomainStoragePatch
- Profile
- ProfileCurrentTrial
- ProfileCurrentTrialCurrent
- ProfileCurrentTrialProjects
- ProfileCurrentTrialProjectsTotal
- ProfileCurrentTrialSpend
- ProfileCurrentTrialSpendRemaining
- Project
- ProjectCapabilities
- ProjectCarbon
- ProjectInfo
- ProjectInvitation
- ProjectInvitationEnvironmentsInner
- ProjectOptions
- ProjectOptionsDefaults
- ProjectOptionsEnforced
- ProjectPatch
- ProjectReference
- ProjectSettings
- ProjectSettingsPatch
- ProjectStatus
- ProjectType
- ProjectVariable
- ProjectVariableCreateInput
- ProjectVariablePatch
- ProxyRoute
- RedirectRoute
- Ref
- Region
- RegionDatacenter
- RegionEnvironmentalImpact
- RegionProvider
- RegionReference
- ReplacementDomainStorage
- ReplacementDomainStorageCreateInput
- ReplacementDomainStoragePatch
- RepositoryInformation
- ResetEmailAddressRequest
- ResourceConfig
- Resources
- Resources1
- Resources2
- Resources3
- Resources4
- Resources5
- Resources6
- ResourcesForDevelopmentEnvironments
- ResourcesForProductionEnvironments
- ResourcesLimits
- ResourcesOverridesValue
- RestrictedAndDeniedImageTypes
- Route
- RouterResourceSettingsForFlexPlan
- RoutesValue
- RuntimeOperations
- SSHKey
- ScheduledCronTasksExecutedByThisApplicationValue
- ScriptIntegration
- ScriptIntegrationConfigurations
- ScriptIntegrationCreateInput
- ScriptIntegrationPatch
- SendOrgMfaReminders200ResponseValue
- SendOrgMfaRemindersRequest
- ServerSideIncludeConfiguration
- ServicesValue
- ServicesValue1
- SlackIntegration
- SlackIntegrationCreateInput
- SlackIntegrationPatch
- SourceOperations
- SpecificOverridesValue
- SplunkIntegration
- SplunkIntegrationCreateInput
- SplunkIntegrationPatch
- SplunkLogForwardingIntegrationConfigurations
- Status
- StickyRoutingConfiguration
- StrictTransportSecurityOptions
- StringFilter
- Subscription
- Subscription1
- SubscriptionAddonsObject
- SubscriptionAddonsObjectAvailable
- SubscriptionAddonsObjectCurrent
- SubscriptionAddonsObjectUpgradesAvailable
- SubscriptionCurrentUsageObject
- SubscriptionInformation
- SumoLogicLogForwardingIntegrationConfigurations
- SumologicIntegration
- SumologicIntegrationCreateInput
- SumologicIntegrationPatch
- SyslogIntegration
- SyslogIntegrationCreateInput
- SyslogIntegrationPatch
- SyslogLogForwardingIntegrationConfigurations
- SystemInformation
- TLSSettingsForTheRoute
- Team
- TeamCounts
- TeamMember
- TeamProjectAccess
- TeamProjectAccessLinks
- TeamProjectAccessLinksDelete
- TeamProjectAccessLinksSelf
- TeamProjectAccessLinksUpdate
- TeamReference
- TheAddonCredentialInformationOptional
- TheAddonCredentialInformationOptional1
- TheBackupScheduleSpecificationInner
- TheBuildConfigurationOfTheApplication
- TheCommandsDefinition
- TheCommandsToManageTheWorker
- TheCommitDistanceInfoBetweenParentAndChildEnvironments
- TheConfigurationOfPathsManagedByTheBuildCacheValue
- TheConfigurationOfTheRedirects
- TheContinuousProfilingConfiguration
- TheCronsDeploymentState
- TheDefaultResourcesForThisService
- TheDisksResources
- TheEnvironmentDeploymentState
- TheEnvironmentSizingConfiguration
- TheHostsOfTheDeploymentTargetInner
- TheHostsOfTheDeploymentTargetInner1
- TheInformationAboutTheAuthor
- TheInformationAboutTheCommitter
- TheIssuerOfTheCertificateInner
- TheMinimumResourcesForThisService
- TheOAuth2ConsumerInformationOptional
- TheOAuth2ConsumerInformationOptional1
- TheObjectTheReferencePointsTo
- ThePathsToRedirectValue
- TheRelationshipsOfTheApplicationToDefinedServicesValue
- TheSpecificationOfTheWebLocationsServedByThisApplicationValue
- TheTreeItemsInner
- TheVariablesApplyingToThisEnvironmentInner
- Ticket
- TicketJiraInner
- Tree
- UpdateOrgAddonsRequest
- UpdateOrgBillingAlertConfigRequest
- UpdateOrgBillingAlertConfigRequestConfig
- UpdateOrgMemberRequest
- UpdateOrgProfileRequest
- UpdateOrgProjectRequest
- UpdateOrgRequest
- UpdateOrgSubscriptionRequest
- UpdateProfileRequest
- UpdateProjectUserAccessRequest
- UpdateProjectsEnvironmentsDeploymentsNextRequest
- UpdateProjectsEnvironmentsDeploymentsNextRequestServicesValue
- UpdateProjectsEnvironmentsDeploymentsNextRequestWebappsValue
- UpdateSubscriptionUsageAlertsRequest
- UpdateSubscriptionUsageAlertsRequestAlertsInner
- UpdateSubscriptionUsageAlertsRequestAlertsInnerConfig
- UpdateTeamRequest
- UpdateTicketRequest
- UpdateUsageAlertsRequest
- UpdateUserRequest
- UpstreamRoute
- Usage
- UsageAlert
- UsageAlertConfig
- UsageAlertConfigThreshold
- UsageGroupCurrentUsageProperties
- User
- UserProjectAccess
- UserReference
- VPNConfiguration
- VerifyPhoneNumber200Response
- VerifyPhoneNumberRequest
- Version
- VersionCreateInput
- VersionPatch
- Vouchers
- VouchersLinks
- VouchersLinksSelf
- VouchersVouchersInner
- VouchersVouchersInnerOrdersInner
- WebApplicationsValue
- WebHookIntegration
- WebHookIntegrationCreateInput
- WebHookIntegrationPatch
- WebhookIntegrationConfigurations
- WorkersValue
Authentication schemes defined for the API:
- Type:
OAuth - Flow:
accessCode - Authorization URL:
https://auth.api.platform.sh/oauth2/authorize - Scopes: N/A
- Type:
OAuth - Flow:
application - Authorization URL: ``
- Scopes:
- admin: administrative operations
To run the tests, use:
composer install
vendor/bin/phpunitThis project is licensed under the Apache 2.0 License. See the LICENSE file for details.