dot CMS

Unlock the Power of PHP with the New dotCMS PHP SDK

Unlock the Power of PHP with the New dotCMS PHP SDK
Freddy

Freddy Montes

Product Manager

Share this article on:

Did you know that PHP powers nearly 80% of all websites? At dotCMS, we recognize the importance of PHP in web development, so we are excited to announce the launch of the dotCMS PHP SDK!

This SDK connects PHP's versatility with dotCMS's content management, allowing for quick creation of dynamic web applications using vanilla PHP or frameworks like Laravel and Symfony.

What does the dotCMS PHP SDK Do?

The SDK gives developers seamless access to page layouts, page content, and navigation data. It also allows developers to quickly integrate the dotCMS Universal Visual Editor so content teams can update content and layouts easily without developer involvement.

Imagine this: your development team enjoys the freedom and control of PHP, while your marketing team can effortlessly manage content through a user-friendly visual interface. This is the power of the dotCMS PHP SDK.

Key Benefits for Developers and Businesses

  • Accelerated Time-to-Market: Connect your PHP applications to dotCMS in less than 5 minutes. This speed significantly reduces development time and gets your projects launched faster.

  • Improved ROI: Faster development cycles translate to quicker project launches and a more rapid return on your investment. The SDK optimizes your workflow for maximum efficiency.

  • Empowered Content Authors: The Universal Visual Editor empowers non-technical users to update content, freeing up developers to focus on more complex tasks. This reduces bottlenecks and accelerates content updates.

  • Flexibility and Control: Leverage the control and flexibility of PHP development while benefiting from a powerful CMS.

  • Server-Side Rendering (SSR): Build projects that benefit from SSR, improving performance and SEO.

It's Easy to Get Started!

Connecting to dotCMS is surprisingly simple. Here's a quick example of how to retrieve a page using the SDK:

First, you can install the SDK using composer, the most used dependency manager for the PHP.

composer require dotcms/php-sdk

Then inside your project:

<?php

use Dotcms\PhpSdk\Config\Config;
use Dotcms\PhpSdk\DotCMSClient;
use Dotcms\PhpSdk\Config\LogLevel;

// 1.  Configuration: Set up your dotCMS connection details
$config = new Config(
    host: 'https://your.dotcms.host',
    apiKey: 'YOUR_API_KEY'
);

// 2. Create the DotCMS Client
$client = new DotCMSClient($config);

try {
    // 3.  Fetch a Page
    $pageRequest = $client->createPageRequest('/about-us', 'json'); // Specify the page path and format
    $page = $client->getPage($pageRequest);

    // Display Page Details
    echo "Page Title: " . $page->page->title . "<br>";

} catch (\Exception $e) {
    echo "Error: " . $e->getMessage() . "<br>";
}
?>

This is just a glimpse of how easily you can integrate dotCMS functionality into your PHP applications.

What's included?

The dotCMS PHP SDK is more than just a library. It's a complete solution that includes:

  • A robust PHP library for seamless connection to dotCMS APIs.

  • Example implementations for popular PHP frameworks like Laravel and Symfony, demonstrating best practices.

  • Ready-to-go dotCMS PHP pages that can be fully edited within the dotCMS Universal Visual Editor. This allows for a truly integrated content management and development experience.

Who is it For?

This SDK is perfect for:

  • Businesses with in-house or partner development teams proficient in PHP.

  • Organizations seeking the control and flexibility of PHP development.

  • Projects that require the performance and SEO advantages of server-side rendering.

  • Companies that want to empower their content editors with an intuitive visual editing experience.

Looking Ahead

We're committed to continuously improving the dotCMS PHP SDK. Future enhancements include:

  • Adding support for the dotCMS Content API for even more comprehensive content management capabilities.

  • Implementing a Type Safety Layer to further simplify development and reduce potential errors.

Get Started Today!

The dotCMS PHP SDK is free and open source. We encourage you to download it, explore its capabilities, and join our growing community. Unleash the combined power of PHP and dotCMS to build exceptional web experiences.

PHP SDK Documentation

We're excited to see what you create with the dotCMS PHP SDK!  Let us know how it goes in our dotCMS Community.