In this post I would like to introduce you to a SharePoint client for PHP available on GitHub. The library provides a SharePoint Online (SPO) client for PHP applications. It allows you to performs CRUD operations on SharePoint data using an SharePoint 2013 REST/OData based API.
PHP:cURL library is used to make HTTP requests to performs CRUD operations on SharePoint data using SharePoint 2013 REST API.
A first example
- SPOClient class represents a REST Service client for the specified SharePoint Online (SPO) site
- The signIn method performs a claims-based authentication. You can find more details about remote authentication in Remote authentication in SharePoint Online post.
The following examples demonstrates how to perform the remaining CRUD operations on SharePoint list data.
List data generator
And finally one more example that demonstrates how to populate Contacts list in SharePoint. For generating fake data we will utilize Faker PHP library, below is provided the complete example:
The library currently supports CRUD operations against SharePoint list data. But since SharePoint 2013 REST covers a much broader set of API, the library could be extended.
Hopefully this helps you get started how you can interact with a SharePoint Online site from a remote Web application written in PHP!