
Announcing the Dagger Community PHP SDK: A New Way to Automate with PHP
February 18, 2025
Feb 18, 2025


At Dagger, our mission is to empower developers to define powerful, reusable workflows as code — directly in the programming languages they love. Today, we’re excited to introduce the Dagger PHP Community SDK, created by and for the PHP developer community!
<?php
declare(strict_types=1);
namespace DaggerModule;
use Dagger\Attribute\DaggerFunction;
use Dagger\Attribute\DaggerObject;
use Dagger\Attribute\Doc;
use Dagger\Container;
use Dagger\Directory;
use function Dagger\dag;
#[DaggerObject]
class HelloDagger
{
#[DaggerFunction]
#[Doc('Build a ready-to-use development environment')]
public function buildEnv(Directory $source): Container
{
$nodeCache = dag()
->cacheVolume('node');
return dag()
->container()
// start from a base Node.js container
->from('node:21-slim')
// add the source code at /src
->withDirectory('/src', $source)
// mount the cache volume at /root/.npm
->withMountedCache('/root/.npm', $nodeCache)
// change the working directory to /src
->withWorkdir('/src')
// run npm install to install dependencies
->withExec(['npm', 'install']);
}
}
Why PHP Developers Will Love the Dagger SDK
If you’re working with PHP, you likely deal with automation challenges—whether it’s building and shipping applications, managing cloud infrastructure, or automating development workflows. The Dagger PHP SDK brings the flexibility of Dagger’s API to PHP, allowing you to:
Define automation workflows in PHP – No need to switch languages just to script tasks.
Run your workflows locally or remotely with full reproducibility – Test and iterate faster.
Easily compose and reuse logic across projects – Keep your automation modular and maintainable.
Leverage Dagger’s caching and portability – Speed up workflows and run them anywhere.
Share content with every Dagger user – All Dagger modules, in any language, can be used together to build your internal platform.
Built by the Community, for the Community
The PHP SDK is a Community SDK, which means it’s maintained by passionate Dagger users who have taken the initiative to bring Dagger’s power to PHP developers. A huge thank you to Paul Dragoonis, John Charman, and Chris Riley for making this happen! Their dedication to open-source innovation is what makes Dagger’s ecosystem thrive.
Get Started with the PHP SDK
Ready to automate with PHP? Here’s how to get started:
Check out the PHP SDK on GitHub
Follow the Dagger Quickstart (now with PHP examples!)
Join the Dagger Community on Discord
What’s Next?
The PHP SDK is just the beginning! As a Community SDK, it will continue to evolve with the help of contributors like you. We can’t wait to see what you build with it.
Have feedback? Questions? Share your thoughts in our community forum or GitHub discussions.
Happy coding! 💙
At Dagger, our mission is to empower developers to define powerful, reusable workflows as code — directly in the programming languages they love. Today, we’re excited to introduce the Dagger PHP Community SDK, created by and for the PHP developer community!
<?php
declare(strict_types=1);
namespace DaggerModule;
use Dagger\Attribute\DaggerFunction;
use Dagger\Attribute\DaggerObject;
use Dagger\Attribute\Doc;
use Dagger\Container;
use Dagger\Directory;
use function Dagger\dag;
#[DaggerObject]
class HelloDagger
{
#[DaggerFunction]
#[Doc('Build a ready-to-use development environment')]
public function buildEnv(Directory $source): Container
{
$nodeCache = dag()
->cacheVolume('node');
return dag()
->container()
// start from a base Node.js container
->from('node:21-slim')
// add the source code at /src
->withDirectory('/src', $source)
// mount the cache volume at /root/.npm
->withMountedCache('/root/.npm', $nodeCache)
// change the working directory to /src
->withWorkdir('/src')
// run npm install to install dependencies
->withExec(['npm', 'install']);
}
}
Why PHP Developers Will Love the Dagger SDK
If you’re working with PHP, you likely deal with automation challenges—whether it’s building and shipping applications, managing cloud infrastructure, or automating development workflows. The Dagger PHP SDK brings the flexibility of Dagger’s API to PHP, allowing you to:
Define automation workflows in PHP – No need to switch languages just to script tasks.
Run your workflows locally or remotely with full reproducibility – Test and iterate faster.
Easily compose and reuse logic across projects – Keep your automation modular and maintainable.
Leverage Dagger’s caching and portability – Speed up workflows and run them anywhere.
Share content with every Dagger user – All Dagger modules, in any language, can be used together to build your internal platform.
Built by the Community, for the Community
The PHP SDK is a Community SDK, which means it’s maintained by passionate Dagger users who have taken the initiative to bring Dagger’s power to PHP developers. A huge thank you to Paul Dragoonis, John Charman, and Chris Riley for making this happen! Their dedication to open-source innovation is what makes Dagger’s ecosystem thrive.
Get Started with the PHP SDK
Ready to automate with PHP? Here’s how to get started:
Check out the PHP SDK on GitHub
Follow the Dagger Quickstart (now with PHP examples!)
Join the Dagger Community on Discord
What’s Next?
The PHP SDK is just the beginning! As a Community SDK, it will continue to evolve with the help of contributors like you. We can’t wait to see what you build with it.
Have feedback? Questions? Share your thoughts in our community forum or GitHub discussions.
Happy coding! 💙
At Dagger, our mission is to empower developers to define powerful, reusable workflows as code — directly in the programming languages they love. Today, we’re excited to introduce the Dagger PHP Community SDK, created by and for the PHP developer community!
<?php
declare(strict_types=1);
namespace DaggerModule;
use Dagger\Attribute\DaggerFunction;
use Dagger\Attribute\DaggerObject;
use Dagger\Attribute\Doc;
use Dagger\Container;
use Dagger\Directory;
use function Dagger\dag;
#[DaggerObject]
class HelloDagger
{
#[DaggerFunction]
#[Doc('Build a ready-to-use development environment')]
public function buildEnv(Directory $source): Container
{
$nodeCache = dag()
->cacheVolume('node');
return dag()
->container()
// start from a base Node.js container
->from('node:21-slim')
// add the source code at /src
->withDirectory('/src', $source)
// mount the cache volume at /root/.npm
->withMountedCache('/root/.npm', $nodeCache)
// change the working directory to /src
->withWorkdir('/src')
// run npm install to install dependencies
->withExec(['npm', 'install']);
}
}
Why PHP Developers Will Love the Dagger SDK
If you’re working with PHP, you likely deal with automation challenges—whether it’s building and shipping applications, managing cloud infrastructure, or automating development workflows. The Dagger PHP SDK brings the flexibility of Dagger’s API to PHP, allowing you to:
Define automation workflows in PHP – No need to switch languages just to script tasks.
Run your workflows locally or remotely with full reproducibility – Test and iterate faster.
Easily compose and reuse logic across projects – Keep your automation modular and maintainable.
Leverage Dagger’s caching and portability – Speed up workflows and run them anywhere.
Share content with every Dagger user – All Dagger modules, in any language, can be used together to build your internal platform.
Built by the Community, for the Community
The PHP SDK is a Community SDK, which means it’s maintained by passionate Dagger users who have taken the initiative to bring Dagger’s power to PHP developers. A huge thank you to Paul Dragoonis, John Charman, and Chris Riley for making this happen! Their dedication to open-source innovation is what makes Dagger’s ecosystem thrive.
Get Started with the PHP SDK
Ready to automate with PHP? Here’s how to get started:
Check out the PHP SDK on GitHub
Follow the Dagger Quickstart (now with PHP examples!)
Join the Dagger Community on Discord
What’s Next?
The PHP SDK is just the beginning! As a Community SDK, it will continue to evolve with the help of contributors like you. We can’t wait to see what you build with it.
Have feedback? Questions? Share your thoughts in our community forum or GitHub discussions.
Happy coding! 💙