The Blog

Laravel

Laravel

Implementing a Custom Laravel Blade Precompiler for Volt and Livewire

John Koster
John Koster
September 4, 2023

Learn how to implement a custom component compiler for Laravel's Blade templating language in this post. We will build a custom compiler that transforms custom component syntax into a Livewire component, leveraging new features provided by Volt. Follow along as we set up the Blade precompiler and parse custom Blade component syntax. Get started by grabbing the example code on GitHub, and don't forget to install the necessary dependencies.

Laravel

Creating a Simple Honeypot Field in Laravel

John Koster
John Koster
April 11, 2023

Learn how to implement a honeypot form mechanism using Laravel. This security measure helps catch bots and automated scripts by adding an inconspicuous form field that human users should leave empty. You can implement the honeypot in two different ways: by creating a custom middleware class or by adding the logic directly to the form's action. Additionally, you can create a custom Blade directive to simplify adding the hidden field to multiple forms.

Laravel

Announcement: All Of the Laravel Articles Are Free

John Koster
John Koster
July 22, 2017

Discover the journey behind "Laravel Artisan: An In Depth Coverage of Laravel Features." Find out why the project was eventually converted into free blog posts on the website. Explore the author's other projects and the motivation behind the switch to a new site. Don't miss the free resource, "Laravel Companion: A Guide to Helpers, Collections And More."

Laravel

Command Interoperability and Laravel Artisan Applications

John Koster
John Koster
December 7, 2016

Learn how to execute Artisan commands from within other Artisan commands in Laravel. Use the call and callSilent methods to call other commands and return the exit code. Pass arguments and options to the called commands using arrays. Output from called commands can be hidden by using the callSilent method. Commands can also be called from other locations within the application's code base by injecting the console kernel or using the Artisan facade. Operating system calls can be made using Symfony's Process component, which is already available in Laravel. Handle process output by supplying a callback function to the process's run method.

Laravel

Customizing The Laravel Artisan Application

John Koster
John Koster
December 7, 2016

Learn how to customize and modify Laravel's Artisan console application to better suit your needs. By extending Symfony's console application, you can make changes to the default command, application name, and version string. Discover where the console application is invoked and brought in, and override the getArtisan method to customize the console application instance. You can change the application name and version number to reflect your own branding. Additionally, you can modify the default command that is executed when no specific command is specified. These modifications are useful for creating a customized experience for your clients and maintaining branding consistency.

Laravel

Laravel Artisan Cache Command: The cache:clear Command

John Koster
John Koster
December 7, 2016

Learn how to clear the cache files of your application using the cache:clear command in Laravel. You can optionally specify the cache store to clear using the store parameter. Check out the examples to see how to use the command.

Laravel

Laravel Artisan Cache Command: The cache:table Command

John Koster
John Koster
December 7, 2016

Learn how to create a new migration for the cache database table using the cache:table command in Laravel. This table is necessary for the database cache driver. The migration creates a cache table with specific properties. Remember to change the table name in additional migration files to avoid errors when running the migrate command.

Laravel

Laravel Artisan Closure Based Commands

John Koster
John Koster
December 7, 2016

Learn about the new shorthand syntax introduced in Laravel 5.3 to simplify writing Artisan commands. The command method in the console kernel allows you to define commands with a signature and a callback function. The signature defines the input requirements, and the callback function has access to the underlying ClosureCommand instance. You can also set a description for the command using the describe method. Additionally, you can register commands using the console.php file in the routes directory.

Laravel

Laravel Artisan Config Command: The config:clear Command

John Koster
John Koster
December 7, 2016

The config:clear command is used to delete the configuration cache file created by config:cache. It will remove the bootstrap/cache/config.php file by default. Use the php artisan config:clear command to clear the configuration cache.

Laravel

Laravel Artisan Custom Styles: Custom Progress Bar Styles

John Koster
John Koster
December 7, 2016

Learn about how to customize console progress bars in Laravel commands. Progress bars in Laravel commands are instances of the Symfony\Component\Console\Helper\ProgressBar class and inherit styles from Symfony's console styles. The default styles differ based on the operating system. The diagram in the article explains the default Windows and Unix-like system styles and the components of a console progress bar. Progress bar formats use placeholders like current, max, bar, percent, elapsed, remaining, estimated, memory, and message to control appearance. Various examples demonstrate how to set formats and customize components like bar character, empty bar character, progress character, and bar width. Other methods like getBarCharacter, getEmptyBarCharacter, getProgressCharacter, setEmptyBarCharacter, setProgressCharacter, setBarWidth, and setMessage are also explained. This article is a valuable resource for anyone looking to customize console progress bars in Laravel commands.

Latest posts

That Escalated Quickly: All the New Things

The past six months or so have been incredibly busy. What started as a new article series about cust...

Read more
Troubleshooting a Statamic Illegal Offset Type Error when Viewing Collection Entries in the Control Panel

In this post I talk about how I resolved a mysterious illegal offset type error when viewing collect...

Read more
Creating Simple HTTP Redirect Routes from a Statamic Site

Generating a custom Laravel routes file from a Statamic website to redirect to a new domain.

Read more
Disabling Vite File Hashes

Disabling file hashes in Vite output can be accomplished by modifying your project's vite.config.js

Read more
Implementing a Custom Laravel Blade Precompiler for Volt and Livewire

Learn how to implement a custom component compiler for Laravel's Blade templating language in this p...

Read more
Creating a Hybrid Cache System for Statamic: Part Five

Part 5 of 6 covers implementing a cache namespace and labeling system, which we can use to target mu...

Read more