DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. OpenShift PHP Rest Client Library

OpenShift PHP Rest Client Library

Hasin Hayder user avatar by
Hasin Hayder
·
Jan. 30, 13 · Interview
Like (0)
Save
Tweet
Share
3.20K Views

Join the DZone community and get the full member experience.

Join For Free

i have been working whole day today on writing this rest client library for php developers. openshift is a fantastic polyglot paas (platform-as-a-service). to perform various operations with your openshift account you need to use their command line tool “rhc” (a gem, requires ruby). their web based admin panel is good for starters, but you need to master the rhc for other essential tasks, for example to add a domain alias or to start/stop/restart your application.

this openshift-php-client library can directly invoke their rest api and makes it easier for you if you are a php developer. this application is in a good stage at this moment and you can do everything with domains, applications and cartridges.

how to use this library? firxt check it out from it’s github repo located at https://github.com/hasinhayder/openshift-php-client . then see the source code of the example.php. the example contains the bare minimum, you can actually do a lot of other things with these domain, application and cartridge object. to understand the scope, feel free to check their source code as well :)

include_once("lib/openshift.php");
$username = "yourusername";
$password = "yourpassword";
$openshift = new openshift($username,$password);
// create a new domain 
$data = $openshift->getdomainmanager()->createdomain("osphp");

// list domains 
$data = $openshift->getdomainmanager()->getdomains();

// rename the domain
$data = $openshift->getdomainmanager()->getdomain("osphp")->updatename("moonlander") ;

// create a zend 5.6 app container 
$data = $openshift->getdomainmanager()->getdomain("osphp")->createapplication("restclient","zend-5.6");

// get all applications 
$data = $openshift->getdomainmanager()->getdomain("osphp")->getapplications();

// get application details
$data = $openshift->getdomainmanager()->getdomain("osphp")->getapplication("restclient")->getdetails();

// stop an application
$data = $openshift->getdomainmanager()->getdomain("osphp")->getapplication("restclient")->stop(); 

// start an application
$data = $openshift->getdomainmanager()->getdomain("osphp")->getapplication("restclient")->start(); 

// restart an application
$data = $openshift->getdomainmanager()->getdomain("osphp")->getapplication("restclient")->restart(); 

// reload an application
$data = $openshift->getdomainmanager()->getdomain("osphp")->getapplication("restclient")->reload(); 

// add an alias
$data = $openshift->getdomainmanager()->getdomain("osphp")->getapplication("restclient")->addalias("mydomain.com");

// remove an alias
$data = $openshift->getdomainmanager()->getdomain("osphp")->getapplication("restclient")->removealias("mydomain.com");

add a mysql cartridge
$data = $openshift->getdomainmanager()->getdomain("osphp")->getapplication("restclient")->addcartridge("mysql-5.1");

// delete a mysql cartridge
$data = $openshift->getdomainmanager()->getdomain("osphp")->getapplication("restclient")->getcartridge("mysql-5.1")->delete();

// there are many other methods supported by applications, domains and the cartridges. for details, check their source code. 

openshift php client library is released under mit license. i am working continuously to add more features to it.



PHP Library OpenShift

Published at DZone with permission of Hasin Hayder, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • The Role of Data Governance in Data Strategy: Part II
  • Taming Cloud Costs With Infracost
  • Continuous Development: Building the Thing Right, to Build the Right Thing
  • Event Driven 2.0

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: