Playing With PHP

0
Language

Level

Beginner

Access

Paid

Certificate

Paid

This series is all about the little projects you build once you’re off the clock. One topic per section, we’ll toy with the fringes of PHP to, for example, blink our lights when a PHPUnit test fails. Why bother? Because it’s fun! Come along and join me.

Add your review

The Hue REST API

To begin, let’s have a look at the Philips Hue REST API. We’ll figure out how to toggle the lights in our room and adjust their colors.

Build a Client App Using Vue

Now let’s leverage Vue 3 and Tailwind to build a simple client app that allows us to control our lights from any web browser.

Hook Into PHPUnit’s Pass/Fail Events

We can hook into PHPUnit’s events, like for passing or failing tests, to change the color of our lights accordingly. GitHub Repo: https://github.com/drehimself/lc-hue-phpunit

Introduction and Styling

Let’s begin by styling our app with Tailwind CSS and extracting it to a Blade component.

Fetch Weather Data With the OpenWeather API

We can use the OpenWeather API along with Laravel’s HTTP client to fetch data for our current and future forecasts.

Leverage Algolia Places

We can make our application more interactive by pulling in Algolia Places for our dropdown of cities. The query string will help us keep track of the currently selected city and keep the majority of logic on the backend.

Extract to a Vue Component

Let’s now make our Weather widget interactive by extracting it to a Vue component. We’ll move much of the logic over from Laravel into Vue and allow it to update whenever the location is changed from the Places API.

Use Livewire

We can also use Livewire to make our weather widget interactive. We’ll re-use much of the logic from the Blade components we created, but make a few changes to make it work with Livewire. We’ll also pull in Alpine.js for some simple DOM manipulation.

User Reviews

0.0 out of 5
0
0
0
0
0
Write a review

There are no reviews yet.

Be the first to review “Playing With PHP”

×

    Your Email (required)

    Report this page
    LiveTalent.org
    Logo