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.
Get ready to meet your new development best friend: the Studio Assistant.
The Studio Assistant is a smart chatbot integrated within Studio, our free and open source local development app, and it’s now available for all Studio users to assist you in building WordPress sites effortlessly.
The Assistant leverages WordPress.com infrastructure and our WordPress knowledge base to provide helpful responses using Retrieval Augmented Generation, so you’ll get tailored-to-WordPress responses every time.
Download Studio for freeBuilding WordPress sites locally has never been easier. With the Studio Assistant, you can quickly configure new sites, manage existing sites, and run complex WP-CLI commands—all through a simple and intuitive chat interface.
Check out what the Assistant can do directly within the Studio app:
There are many reasons to love the Studio Assistant, but here are just a few:
But seeing is believing, right? Here are some exciting use cases for the Assistant:
Say you’re looking for an SEO plugin but are unsure of your options. Ask the Assistant, and you’ll get specific recommendations.
When you ask the Assistant to write posts or code, it will provide you with Gutenberg blocks or code that you can simply copy and paste.
Moreover, the Studio Assistant is trained on WordPress-specific documentation and has access to a bunch of context about your site; therefore, it’s able to respond with site-specific information and recommendations.
The Assistant is extra slick because you can run commands inline, removing the steps of installing WP-CLI and running commands in your terminal––simply click Run, and your recommended commands will be run for you:
You’ll also get a handy output about what the suggested commands do, helping you learn as you use the tool. This aligns with our desire to continue giving developers more ways to level-up their development skills and knowledge.
And if that isn’t enough to convince you to incorporate the Studio Assistant into your development workflow, here’s what Hoang Hxn said after he got early access to the feature:
After more than two months of using the Studio Assistant, it has become a great tutor that has helped me learn WordPress 100 times faster. I can ask questions in my native language, and the Studio Assistant can return Vietnamese results, in both complex terms and simple, easy-to-understand language for beginners like me.
In addition, I can execute CLI commands directly and quickly without knowing the technicalities, and I can create sample posts and pages quickly. I can also ask questions for beginners (like “what is the purpose of WordPress plugins?”) without being afraid that they’re “too beginner.”
The Studio Assistant answers these basic questions quickly, accurately, and directly in the Studio app; it prevents me from having to go to forums and wait for my questions to be answered.
We thought you might be.
Start leveraging Studio Assistant’s powerful capabilities in just a few steps:
We’re thrilled to finally share the Studio Assistant with you. We’d love to hear about some of the tasks you hope to automate with the Studio Assistant in the comments below.
As a reminder, Studio is a free, open source tool, so we welcome any and all feedback in GitHub. Explore other Issues and create your own here.
You can also explore the Studio documentation for more tips on using the Assistant.
Download Studio for freeRead more https://wordpress.com/blog/2024/10/29/studio-assistant/
Laravel Sprout by Ollie Read is a multitenancy package for Laravel under active development. It hasn't hit a v1.0 release, but we decided to share it with those who want to try it out early and follow along with the development.
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>Guess this is the perfect time to announce that I'm working on a package for Laravel called Sprout, which aims to provide a feature-rich and flexible multitenancy solution for Laravel!https://t.co/MksaXmfEy8
— ollieread (@ollieread) September 4, 2024
Some of these features might be under development and may change. The following is a list of features either finished, in progress, or planned:
Check out the Sprout roadmap for more details on features and their current development status. Sprout plans to offer domain-based tenancy, multi-database tenant support, screencasts, and more.
You can learn more about this package and view the source code on GitHub at sprout-laravel/sprout. I would also suggest checking out the FAQ section of the readme.
The post Sprout Multitenancy Package for Laravel 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/sprout-laravel-multitenancy-package
Read more https://build.prestashop-project.org/news/2024/upcoming-live-update-october-2024/
If most food bloggers had their way, a recipe blog post would likely be simpler—a few images, a short introduction with helpful tips, and the recipe itself. Sadly that’s not the reality of the internet today with flashing ads taking over your screen while you’re up to your elbows in focaccia dough. But it hasn’t always been that way.
In the beginning, think early aughts, food blogging was entirely disconnected from ad revenue and Google’s algorithmic whims. Most food bloggers then were in fact food writers, using an online audience to develop their voice and share a much-loved recipe.
There were so few recipe publishers, we hung onto their every word and looked forward to each new post—100% ad-free. A few would get cookbook deals or become contributors to our favorite food magazines. We giddily followed them off the screen and into print. It was the golden age of food writing.
Then came the flood. Aspiring food bloggers popped up in droves, eager to replicate the success of what those early pioneers had made look so effortless. Along the way, the terrain had shifted dramatically.
You need to be more than just a great recipe developer and writer now—you need to be a professional photographer, videographer, food stylist, marketer, and SEO expert. If you could do it all, and do it well, you could make a very comfortable living from your home kitchen.
All of this expertise from one person requires a lot of time and financial investment. Beyond the basic costs of running a website—like hosting, recipe plugins, and software—there’s the need for high-end camera equipment, online courses, and endless food styling props. For new bloggers, these expenses add up fast.
Today, crafting a single recipe optimized for both Google (more on that below) and social media can easily take over 20 hours. And that’s before you’ve even nailed down a version of the recipe that’s consistently reliable and simple to follow.
As the saying goes, time is money. Enter ad placements—the lifeline that generates the revenue food bloggers rely on to keep the lights on.
This is where RPMs come in, aka the soft, gooey center of why food blogs can seem so tediously long.
For food bloggers, ad revenue is based on RPMs (Revenue Per Mille), which is the amount earned per 1,000 sessions. This amount can fluctuate based on a number of factors, including time of year, device, traffic source, time on page, and ad density. Ad density is one of the few factors a blogger can control and plays a big role in boosting RPM—more ads mean higher earnings and longer posts create more opportunities for ad placements. More content, more ads, more revenue!
But it’s not as simple as it sounds. There are millions of food blogs, and only a small percentage are highly profitable. Early-stage food bloggers are often fueled by sweat equity, working hard in hopes of eventually breaking into the top tier of high-earning bloggers.
To qualify for some of the larger ad networks, food bloggers need at least 100,000 monthly pageviews. With that level of traffic, a food blogger might earn between $2,000 and $3,000 per month, or around $24,000 to $36,000 annually. Longer posts can drive up those RPMs.
The ad networks were primarily responsible for this initial push to longer posts, even if you were just waxing poetic about your weekly trip to Costco while losing sight of that blueberry muffin recipe your readers are after.
Then Google said enough. We’ll reward the sites that demonstrate expertise, through a combination of high-quality, relevant content and author credibility—aka the helpful content update.
Nowadays, personal stories have largely given way to detailed instructions and practical tips, such as where to buy the author’s go-to Thai curry paste online (which, of course, will be an affiliate link—because yes, food blogging is a real job, and bloggers need to earn a living too).
This added information above the recipe serves two main purposes:
Better rankings lead to more traffic—and more revenue.
If you’re a food blogger trying to maintain the delicate balance between performing well in search and keeping your readers happy, do your best to ensure that the content above the recipe card offers value to your readers.
Here are some suggestions for relevant content to include:
With literally millions of food sites to choose from, think of personality as the sprinkles that set you apart, but relevant content is what establishes your expertise and keeps readers coming back for more.
Even John Mueller, who coordinates Google Search Relations efforts, recommends making content for your readers first. What makes you, your recipe, and your corner of the internet unique, helpful, and relevant?
Food is a highly personal topic, filled with memories and experiences food bloggers are generous enough to share. Whether they’re helping us recreate a beloved restaurant dish at home or offering a comforting family recipe, they’re here to guide us every step of the way.
Now that you’ve gotten a glimpse behind the scenes, here are a few ways you can support the recipe publishing community:
If you find ads and anecdotes distracting, simply use the “Jump to Recipe” button at the top of most recipe posts. It’ll take you straight to the recipe. While you may still encounter a few ads within the recipe card, it’s a small trade-off for a well-written, free-to-you recipe.
For a completely ad-free experience, consider buying a cookbook, a paid recipe subscription service, or better yet—give your grandma a call. She probably has a recipe and a story you’ll love, and let’s face it, you’re probably overdue for a chat.
Start sharing your favorite recipes with a blog hosted on WordPress.com.
Run ads and install plugins on our Business plan, and let us manage the rest. Get unlimited traffic, unstoppable security, and the power of WordPress, all for one low price.
Get WordPress.com hostingRead more https://wordpress.com/blog/2024/10/28/recipe-story/
Laravel provides a robust CLI framework built on top of the popular Symfony Console component, which brings the best features of Laravel to the command line. While Laravel is traditionally used to create web applications, some applications need robust CLI commands that you can run via Docker in production environments.
If you are building a CLI-only project, you could also consider using the community project Laravel Zero. Everything we discuss in this article will work with Laravel or Laravel Zero (with a few tweaks to the Docker image).
We will build a small stock checker CLI (using the Polygon.io API) that you can run via Docker, which
provides some subcommands to do things like check stocks. We will
build a stock:check
command that will look up stocks
for a given date using the stock's symbol:
php artisan stock:check AAPL
At the time of writing, Polygon.io provides a free basic API plan that allows 5 API calls per minute and goes back two years ago. If you want to follow along, you'll need to have an API key. Using an API key will also let us illustrate how to configure secrets to use with our Docker image.
The first thing we'll do is create the Laravel project. If you are following along, you will need to Install PHP and the Laravel installer:
laravel new stock-checker --git --no-interaction
We don't need any starter kits since our application is just a
CLI, so we use the --no-interaction
flag to just
accept all the defaults. If you can run php artisan
inspire
after creating the stock-checker project, you're
ready to get started:
php artisan inspire
“ I begin to speak only when I am certain what I will say is not better left unsaid. ”
— Cato the Younger
Lastly, we need to create a few files to work with Docker during development, though consumers don't necessarily need anything other than a container runtime to use the application:
mkdir build/
touch \
.dockerignore \
compose.yaml \
build/Dockerfile
We created the Dockerfile
file in the
build
folder. I prefer to store Docker configuration
files in a subdirectory to neatly organize things like INI
configuration files and any Docker-related project files.
We have everything needed to get started. In the next section, we'll scaffold a command and set up the application to run with Docker.
Our application will start with one check
command
to look up US stock details for a given stock symbol. We won't
focus on the contents of this file, but if you want to follow
along, create a command file with Artisan:
php artisan make:command CheckStockCommand
Add the following code to the newly crated
CheckStockCommand.php
file found in the
app/Console/Commands
folder:
<?php
namespace App\Console\Commands;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
class CheckStockCommand extends Command
{
protected $signature = 'stock:check {symbol} {--d|date= : The date to check the stock price for}';
protected $description = 'Check stock price for a given symbol.';
public function handle()
{
$symbol = Str::upper($this->argument('symbol'));
// Get the most recent trading weekday.
$date = now()->previousWeekday();
if ($dateOption = $this->option('date')) {
$date = Carbon::parse($dateOption);
if ($date->isToday() || $date->isFuture()) {
$this->error('Date must be in the past.');
return;
}
}
if ($date->lt(now()->subYear())) {
$this->error('Date must be within the last year.');
return;
}
// Find the Ticker Details
$ticker = $this->getClient()
->withUrlParameters(['symbol' => $symbol])
->withQueryParameters(['date' => $date->toDateString()])
->throw()
->get("https://api.polygon.io/v3/reference/tickers/{symbol}")
->json('results');
$openClose = $this->getClient()
->withUrlParameters([
'symbol' => $symbol,
'date' => $date->toDateString()
])
->get("https://api.polygon.io/v1/open-close/{symbol}/{date}?adjusted=true");
if ($openClose->failed()) {
$this->error("Could not retrieve stock data.\nStatus: " . $openClose->json('status') . "\nMessage: " . $openClose->json('message') . "\n");
return;
}
$this->info("Stock: {$ticker['name']} ({$ticker['ticker']})");
$this->info("Date: {$date->toDateString()}");
$this->info("Currency: {$ticker['currency_name']}");
$this->table(['Open', 'Close', 'High', 'Low'], [
[
number_format($openClose['open'], 2),
number_format($openClose['close'], 2),
number_format($openClose['high'], 2),
number_format($openClose['low'], 2),
],
]);
}
protected function getClient(): PendingRequest
{
return Http::withToken(config('services.polygon.api_key'));
}
}
The console command looks up a stock symbol for a past date
within the last year and returns basic information about the stock
for that given date. For this command to work, we need to define a
service configuration and configure a valid key. Add the following
configuration to the config/services.php
file that the
command will use to configure the API key:
// config/services.php
return [
// ...
'polygon' => [
'api_key' => env('POLYGON_API_KEY'),
],
];
Make sure to add the POLYGON_API_KEY
to your
.env
file, and add the env variable to
.env.example
as a blank value:
# .env
POLYGON_API_KEY="<your_secret_key>"
# .env.example
POLYGON_API_KEY=
If you run the command locally, you'll get something like this if you enter a valid stock symbol:
php artisan stock:check AAPL
Stock: Apple Inc. (AAPL)
Date: 2024-10-25
Currency: usd
+--------+--------+--------+--------+
| Open | Close | High | Low |
+--------+--------+--------+--------+
| 229.74 | 231.41 | 233.22 | 229.57 |
+--------+--------+--------+--------+
We've verified that the command works, and now it's time to see how we can create a Docker image to house our CLI. Docker allows anyone to use our CLI without any of the complicated knowledge about setting up a runtime for it.
The last thing we'll do before creating the Docker image is add
the .env
file to the .dockerignore
file
we created during setup. Add the following line to the
.dockerignore
file so that we don't copy sensitive
secrets we have locally during a build:
.env
We are ready to configure the CLI to work with Docker. There are a few typical use cases for a CLI-based Docker image:
All of the above use cases apply to how we configure the
Dockerfile
, and this article will demonstrate a few
ways you can structure the image for a CLI. We will consider
running our CLI as one single command or providing a way for users
to run multiple subcommands.
Our Dockerfile is based on the official PHP CLI image, and will
use the ENTRYPOINT instruction to make the stock:check
command the single command that the image can run. Without
overriding the entrypoint, all commands issued to our image will
run in the context of the stock:check
command:
FROM php:8.3-cli-alpine
RUN docker-php-ext-install pcntl
COPY . /srv/app
WORKDIR /srv/app
ENTRYPOINT ["php", "/srv/app/artisan", "stock:check"]
CMD ["--help"]
Note: installing the pcntl extension in Docker CLI projects allows graceful shutdown of Docker containers using process signals. We don't demonstrate that in this command, but if you have a long-running daemon, you will need to handle graceful shutdowns in any server environment, including containers.
The ENTRYPOINT instruction specifies the command executed when the container is started. What's neat about it in the context of our CLI is that all commands we pass to the container when we run it are appended to the entrypoint. Let me try to illustrate:
# ENTRYPOINT # Default CMD
php artisan stock:check --help
# Above is equivalent to running this:
docker run --rm stock-checker
# ENTRYPOINT # Override CMD
php artisan stock:check AAPL
# Above is equivalent to running this:
docker run --rm stock-checker AAPL
We are demonstrating that the ENTRYPOINT allows running one command, but if you make this small tweak, you can run any of the commands available in the Artisan console:
FROM php:8.3-cli-alpine
RUN docker-php-ext-install pcntl
COPY . /srv/app
WORKDIR /srv/app
ENTRYPOINT ["php", "/srv/app/artisan"]
CMD ["list"]
Now the entry point is artisan
, giving us the
ability to run any command within the Artisan console. If you are
distributing a CLI to other users, you don't want to expose
commands other than the ones you've defined, but as it stands now,
they can run all commands available to your application.
Running the php artisan list
command will now be
the default when running the Docker image without any command
arguments. We can easily run our stock checker command and other
commands we make for our CLI as follows:
docker build -t stock-checker -f build/Dockerfile .
# Run the stock checker
export POLYGON_API_KEY="<your_key>"
docker run --rm --env POLYGON_API_KEY stock-checker stock:check AAPL
The stock:check
and AAPL
parts are
make up the CMD now. Before, the stock:check
was the
only command the CLI could run without overriding the entrypoint
(which you can do via the --entrypoint=
flag with
docker run
.
Notice that our CLI requires an environment variable to
configure credentials. Using the --env
flag we can
pass in a local ENV variable that we exported. Depending on your
application needs, you could provide a configuration file that the
CLI reads from a secret volume mount. For the convenience of this
article, we use Docker's built-in ENV capabilities to run the
CLI.
If you need to run a CLI command in your Laravel app via Docker,
you'll typically have a php-fpm
Docker image
containing your web app/API. Instead of building a separate CLI
image, you can tweak the entrypoint and command to run as an
Artisan console instead of a web app. Everything will look similar
to what we have, and the benefit is that you can reuse your web app
image to also run the CLI:
docker run --rm my-app --entrypoint=/srv/app/artisan stock:check AAPL
That's the basics of running a Laravel CLI with Docker using the ENTRYPOINT to define the base command that our Docker image will use to run commands. You can learn more about entrypoint and cmd in the official Dockerfile reference.
The post Creating a CLI Application With Laravel and Docker 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/creating-a-cli-app-with-laravel-and-docker