The essential news about content management systems and mobile technology. Powered by Perfect Publisher and XT Search for Algolia.
The News Site publishes posts to the following channels: Facebook, Instagram, Twitter, Telegram, Web Push, Tumblr, and Blogger.
The Command Validator package by Andrea Marco Sartori makes validating the input of console commands a cinch using Laravel's beloved Validator. All the Laravel Validator rules you know and love work with this package, along with any custom validation rules.
This package integrates with your application's console commands
using the provided ValidatesInput
trait, which
includes an abstract rules()
method. The command
signature looks like the following:
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Cerbero\CommandValidator\ValidatesInput;
class SampleCommand extends Command
{
use ValidatesInput;
protected $signature = 'app:sample {--start-date=}';
// ...
public function rules(): array
{
return ['start-date' => 'date_format:Y-m-d'];
}
}
I find it really neat that you can use a closure-based custom validation rule directly in your console command with command-specific business logic:
public function rules(): array
{
return [
'start-date' => [
'date_format:Y-m-d',
function (string $attribute, mixed $value, Closure $fail) {
$date = Carbon::parse($value);
$startOfYear = Carbon::now()->startOfYear();
if ($date->lessThan($startOfYear)) {
$fail("The {$attribute} must be a date from {$startOfYear->format('Y-m-d')} or later.");
}
}
],
];
}
When validation passes, you know you're working with valid
input, and your handle()
method can stay clean from
manual validation checks.
Another neat use-case using the built-in validation rules is
validating that an input exists in the database automatically with
the exists
rule:
public function rules(): array
{
return ['user-id' => 'exists:users,id'];
}
Sure, you could easily query a user and conditionally return an
error, but I think it's neat that you can validate it using
exists
automatically and give back a default error
message when a record doesn't exist.
You can use this package in your project by installing it via Composer:
composer require cerbero/command-validator
Learn more about this package, get full installation instructions, and view the source code on GitHub.
The post Validate Console Command Input With the Command Validator Package appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.
Read more https://laravel-news.com/validate-console-command-input-with-the-command-validator-package
Read more https://build.prestashop-project.org/news/2024/autoupgrade-v6.1-release/
Your online presence is paramount to the success and well-being of your future self. Whether it’s for sharing your latest creative project, building an impressive portfolio, or simply expressing your ideas, owning a personal website gives you the power to control your online identity. It’s a space where you can showcase your work, share your story, and set yourself apart in a sea of digital noise.
A simple website can, in fact, change the world.
At WordPress.com, we know that students are at the forefront of driving online culture. Michael Dell founded Dell while he was a student at the University of Texas. Google came to life when Larry and Sergey were at Stanford. Mark Zuckerberg was 19 when he started Facebook. We could keep going.
To kickstart your own world-changing ideas, we want to give you a free website.
Starting this week, university students can get a free Premium WordPress.com website for one year. We’re offering this opportunity to the first 1,000 students who sign up.
Get your free websiteA website is more than a tool. It’s an investment in your future. As the job market becomes increasingly competitive, having an online space where you can display your work, write about your passions, and connect with like-minded people is invaluable. From resumes to portfolios to blogs, your WordPress.com site will grow as you do.
Here’s what’s included when you take advantage of this free website offer:
No matter what you’re creating, WordPress.com’s Premium plan gives you all the tools you need to succeed.
Here’s how you can grab this amazing deal:
This offer is perfect for students looking to stand out in their personal and professional journeys. Don’t miss out on this chance to create a space that’s truly your own.
Having your own website is a game-changer in an online world increasingly controlled by social media algorithms. You’ll stand out by breaking the mold and announcing yourself as an individual, unmoved by the platform of the moment.
WordPress.com is here to help you take that leap.
Take control of your digital identity. Sign up now and claim your free website while spots are still open!
Get your free websiteRead more https://wordpress.com/blog/2024/09/17/free-websites-students/
Laravel Herd released v1.11 this week, a significant update that includes Laravel Forge integration, sharing Herd project configuration across a team, a convenient profiler integration, and more:
Herd.yml
fileherd profile
Herd now has direct integration with Laravel Forge, enabling you to deploy your site directly from Herd, open an SSH connection on the server, or even open your site on forge.laravel.com. Head over to the documentation to learn more!
With Herd v1.11, you can share project configuration with your
team using a Herd.yml
file in the root of your
project. You can configure the project name, domain aliases, PHP
version, and SSL certificates.
You set up the Herd.yml
using the herd
init
command. If your project doesn't have the file, the
init
command prompts you through the setup process.
Pro users can also define services in the Herd.yml
file.
When a new developer clones your project, running herd
init
will get them up and running immediately, and all
developers will have the same setup. Projects can configure the
Forge server and site IDs to share site configurations with all
developers.
Check out the Herd documentation to learn all about Sharing project configurations.
The Herd v1.11 update is available immediately on macOS, with the Windows release happening soon.
Herd v1.11 has a new profiler for identifying performance issues in your code. Herd makes profile requests, CLI scripts, and long-running tasks seamless.
Here's an example of profiling Artisan commands via the Herd CLI:
herd profile artisan my-command
Herd's dump debugging features a new custom PHP extension that
makes using dd()
and dump()
automatic.
You can also configure Herd to dump queries, HTTP requests, views,
jobs, and logs.
You can learn more about Herd's features in the official documentation.
The post Laravel Herd v1.11 Adds Forge Integration, Dump Updates, and More in v1.11 appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.
Read more https://laravel-news.com/laravel-herd-1-11-0
TemPHPest is an extension for Visual Studio Code to improve writing PHP in VS Code. Created by Liam Hammett, this package adds rich PHP features that will enhance the experience tremendously while writing PHP:
TemPHPest is an extension for VSCode that I’ve been working on to bring nice little tweaks and features to improve working with PHP. Each feature could probably be a separate extension, but being bundled in one is easier for me to maintain and you to install.
Let's highlight a few features that launched with TemPHPest for VS Code:
Creating a PHP file in VS Code gives you an empty file (without
PHP tags) out of the box, but TemPHPest uses PSR naming conventions
to fill out an empty class/interface/trait/etc, based on the file's
name. For example, creating a PHP file in app/Enums
will stub out an enum for you with the proper namespace:
<?php
namespace App\Enums;
enum Statuses
{
}
TemPHPest supports a few code actions during the initial release, such as converting arrays to short arrays syntax and combining string concatenation. According to the author of the extension, the number of code actions available will grow over time.
If you're updating a string and add an interpolated value, TemPHPest automatically changes the line to use double quotes. This is a small paper cut that gets really annoying when you have to swap single quotes for double quotes.
When using BLADE
heredoc and nowdoc strings,
strings are highlighted with the Blade syntax (you'll need a
separate extension to provide blade syntax highlighting)
To get started with TemPHPest, install it from the TemPHPest - Visual Studio Marketplace page. You can also search for "TemPHPest" directly in the VS Code Extensions menu and install it that way.
The post TemPHPest PHP Extension for VSCode appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.
Read more https://laravel-news.com/temphpest-php