Unofficial JavaScript SDK for the Laravel Forge Api
With NPM:
npm install forge-sdk
With Yarn:
yarn add forge-sdk
The SDK harneses Promises and the Fetch Api to handle requests.
import Forge from 'forge-sdk'
let forge = new Forge(API_KEY)
// Get Servers
let servers;
forge.servers()
.then(r => servers = r)
forge.servers()
forge.server(serverId)
forge.rebootServer(serverId)
forge.rebootMysql(serverId)
forge.stopMysql(serverId)
forge.rebootPostgres(serverId)
forge.stopPostgres(serverId)
forge.rebootNginx(serverId)
forge.stopNginx(serverId)
forge.siteNginxFile(serverId, siteId)
forge.updateSiteNginxFile(serverId, siteId, content)
forge.installBlackfire(serverId, data)
forge.removeBlackfire(serverId)
forge.installPapertrail(serverId, data)
forge.removePapertrail(serverId)
forge.daemons(serverId)
forge.daemon(serverId, daemonId)
forge.createDaemon(serverId, data)
forge.restartDaemon(serverId, daemonId)
forge.deleteDaemon(serverId, daemonId)
forge.firewallRules(serverId)
forge.firewallRule(serverId, ruleId)
forge.createFirewallRule(serverId, data)
forge.deleteFirewallRule(serverId, ruleId)
forge.sites(serverId)
forge.site(serverId, siteId)
forge.createSite(serverId, data)
forge.updateSite(serverId, siteId, data)
// NOT FOUND IN API DOCS --- @TODO: CHECK OUT FORGE PHP SDK
// refreshSiteToken(serverId, siteId){}
forge.deleteSite(serverId, siteId)
forge.siteEnvironmentFile(serverId, siteId)
forge.updateSiteEnvironmentFile(serverId, siteId, content)
forge.installGitRepositoryOnSite(serverId, siteId, data)
forge.destroySiteGitRepository(serverId, siteId)
forge.siteDeploymentScript(serverId, siteId)
forge.updateSiteDeploymentScript(serverId, siteId, content)
forge.enableQuickDeploy(serverId, siteId)
forge.disableQuickDeploy(serverId, siteId)
forge.deploySite(serverId, siteId)
forge.resetDeploymentState(serverId, siteId)
forge.siteDeploymentLog(serverId, siteId)
forge.installWordPress(serverId, siteId, data)
forge.removeWordPress(serverId, siteId)
forge.updateLoadBalancingConfiguration(serverId, siteId, data)
forge.workers(serverId, siteId)
forge.worker(serverId, siteId, workerId)
forge.createWorker(serverId, siteId, data)
forge.deleteWorker(serverId, siteId, workerId)
forge.restartWorker(serverId, siteId, workerId)
forge.certificates(serverId, siteId)
forge.certificate(serverId, siteId, certificateId)
forge.createCertificate(serverId, siteId, data)
forge.deleteCertificate(serverId, siteId, certificateId)
forge.getCertificateSigningRequest(serverId, siteId, certificateId)
forge.installCertificate(serverId, siteId, certificateId)
forge.activateCertificate(serverId, siteId, certificateId)
forge.obtainLetsEncryptCertificate(serverId, siteId, data)
forge.mysqlDatabases(serverId)
forge.mysqlDatabase(serverId, databaseId)
forge.createMysqlDatabase(serverId, data)
forge.updateMysqlDatabase(serverId, databaseId, data)
forge.deleteMysqlDatabase(serverId, databaseId)
forge.mysqlUsers(serverId)
forge.mysqlUser(serverId, userId)
forge.createMysqlUser(serverId, data)
forge.updateMysqlUser(serverId, userId, data)
forge.deleteMysqlUser(serverId, userId)