Chromecast CastV2 implementation in PHP - control Chromecasts
Latest commit f3394af Nov 27, 2016 @ChrisRidings readme
Failed to load latest commit information.
CCprotoBuf.php Tidyup Nov 27, 2016
Chromecast.php Add sendMessage to URN Nov 27, 2016 readme Nov 27, 2016
index.php Add sendMessage to URN Nov 27, 2016


Functions to control a Chromecast with PHP using a reverse engineered Castv2 protocol. Provides ability to control a Chromecast either locally or remotely from a server.

Code Example

// Create Chromecast object and give IP and Port
$cc = new Chromecast("","7019");

// Launch the Chromecast App

// Wait for the application to be ready
$response = "";
while (!preg_match("/Application status is ready/s",$response)) {
        $response = $cc->getCastMessage();

// Connect to the Application

// Send the URL

// Keep the connection alive with heartbeat
while (1==1) {


Because this project is primarily intended to run from servers to a remote Chromecast on a different network (e.g. your TV at home), there's no discovery. You need to know the IP of your Chromecast (Chromecasts use mdns for announcement so you can use dns-sd to find it if you don't know). The default port a Chromecast uses is 8009.

If sending content to your home Chromecast from an internet server, you will probably need to enable port forwarding on your router. In which case, use the IP your ISP has assigned you and the port you've chosen to forward.


This is only the functional beginnings of this project. For example: notable things yet to do are:

  1. Handle binary payloads when encoding to protobuf
  2. Protobuf decoding to message objects
  3. Handle ping/pings properly

Feel free to help out!