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.
This week, the Laravel team released v11.27, with a configurable
default currency in the Number helper, a
Str::doesntContain()
method,
Schema::hasTable()
performance improvements, and
more.
Ryan Holton contributed a configurable default
currency setting for the Number
helper. The
USD
currency setting is still the default, but now you
can define a different default without using the in
argument to override:
use Illuminate\Support\Number;
// Set the default currency
Number::useCurrency('EUR');
$currency = Number::currency(1000);
// β¬1,000.00
$currency = Number::currency(1000, in: 'USD');
// $1,000.00
// Some code that uses USD and defaults back to EUR after
Number::withCurrency('USD', function () {
//
});
You can see the example output with this Tinkerwell session:
doesntContain()
methodRyan Holton contributed a
doesntContain()
method to the Str
helper,
which is the inverse of the contains()
method:
use Illuminate\Support\Str;
$str = 'My favorite food is Pizza';
Str::doesntContain($str, 'Steak'); // true
Str::doesntContain($str, 'Pizza'); // false
Str::doesntContain($str, ['Steak', 'Spaghetti']); // true
Str::doesntContain($str, ["Steak", "Spaghetti", "Pizza"]); // false
You can see the example output with this Tinkerwell session:
Schema::hasTable()
PerformanceHafez Divandari contributed a performance
update to the Schema::hasTable()
method:
The
Schema::hasTable()
method is using theSchema::getTable()
method internally, which could sometimes result in an expensive query. This PR improves the performance ofSchema::hasTable()
by using more lightweight queries.
Str::inlineMarkdown()
Ryan Chandler added markdown extension support
to the Str::inlineMarkdown()
and
str()->inlineMarkdown()
methods, matching the
update in Laravel
11.14 to add extension support to the markdown()
method.
Ollie Read contributed an update to the HTTP Kernel that allows programmatic insertion of the middleware in relation to existing middleware in the priority stack. Specifically, it introduces two new public methods:
These changes make it easier for package developers to manage middleware priority without requiring user intervention.
Here are two examples from the pull request description:
$kernel->addToMiddlewarePriorityAfter(
\Illuminate\Routing\Middleware\ValidateSignature::class,
[
\Illuminate\Cookie\Middleware\EncryptCookies::class,
\Illuminate\Contracts\Auth\Middleware\AuthenticatesRequests::class,
],
);
$kernel->addToMiddlewarePriorityBefore(
\Illuminate\Routing\Middleware\ValidateSignature::class,
[
\Illuminate\Cookie\Middleware\EncryptCookies::class,
\Illuminate\Contracts\Auth\Middleware\AuthenticatesRequests::class,
],
);
You can see the complete list of new features and updates below and the diff between 11.26.0 and 11.27.1 on GitHub. The following release notes are directly from the changelog:
Illuminate\Support\php_binary()
by
@crynobone in https://github.com/laravel/framework/pull/53008Schema::hasTable()
performance by
@hafezdivandari in https://github.com/laravel/framework/pull/53006Str::inlineMarkdown()
by @ryangjchandler in https://github.com/laravel/framework/pull/53033make:model
for Form Requests by
@joshmanders in https://github.com/laravel/framework/pull/53052shouldConvertToBoolean
when parameter uses dot
notation by @bytestream in https://github.com/laravel/framework/pull/53048--json
flag to queue:work
command for structured logging by @josecl in https://github.com/laravel/framework/pull/52887The post Laravel 11.27 Released 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-11-27-0
The Open Source Pledge is a group of companies with a shared commitment to paying the maintainers of the Open Source software.
The pledge aims to establish a new social norm in the tech industry of companies paying Open-Source maintainers so that burnout and related security issues, such as those in XZ and Apache Log4j, can become a thing of the past.
Every modern businessβwhether they know it or notβrelies on Open Source software, yet few give back. The PHP Foundation celebrates the #OpenSourcePledge, whose members have committed to correcting this imbalance. Together, we can build a stronger, more resilient OSS ecosystem. π± -- The PHP Foundation
Companies that have already signed up include Laravel, Sentry, Private Packagist, and more. You can see a full list on their members page.
If you are a company that would like to join, they ask you to pay $2,000 per year per developer at your company. Then, self-report annually with a blog post outlining your payments to maintainers.
For more information about the pledge, visit the Open Source Pledge site.
The post Join the Open Source Pledge 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/open-source-pledge
Prism is a powerful Laravel package for integrating Large Language Models (LLMs) into your applications. Using Prism, you can easily use different AI providers using the package's driver pattern, which gives you a unified interface to work with popular AI providers out of the box. Prism has three built-in providers available at the time of writingβAnthropic, Open AI, and Ollamaβwith the ability to create custom drivers:
// Anthropic
$prism = Prism::text()
->using('anthropic', 'claude-3-5-sonnet-20240620')
->withSystemPrompt(view('prompts.nyx'))
->withPrompt('Explain quantum computing to a 5-year-old.');
$response = $prism();
echo $response->text;
// Open AI
$prism = Prism::text()
->using('openai', 'gpt-4o')
->withSystemPrompt(view('prompts.nyx'))
->withPrompt('Explain quantum computing to a 5-year-old.');
// Ollama
$prism = Prism::text()
->using('ollama', 'qwen2.5:14b')
->withSystemPrompt(view('prompts.nyx'))
->withPrompt('Explain quantum computing to a 5-year-old.');
You can learn more about this package and get full installation instructions in the official Prism documentation. The source code is available on GitHub at echolabsdev/prism.
The post Prism is an AI 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/prism-ai-laravel
Tired of managing different development tools across projects? cpx (Composer Package Executor) is a handy tool developed by Liam Hammett that simplifies your workflow. Similar to npx for npm, cpx allows you to run any command from a Composer package, even if it's not installed in your project.
Say goodbye to version conflicts and installation hassles. cpx takes care of package installations and updates behind the scenes, letting you focus on what matters - coding. This ensures consistency across your projects, whether you're working solo or collaborating in a team.
To install cpx you do so using composer:
composer global require cpx/cpx
Then, you execute any composer package by doing:
cpx vendor/package <command>
For example:
cpx laravel/installer new
# Or, for popular packages, you can use the command's alias directly
cpx laravel new
If you switch between numerous projects, they may use different
tooling and so cpx will help to normalize your workflow by
providing commands that actually detect what tools your project is
using and uses the correct one for you. Are you working on a
project that uses Pests for testing? No problem! cpx automatically
detects your project's testing framework (including PHPUnit or
Codeception) and runs the appropriate tests with cpx
test
. Similar logic applies to static analysis with
cpx check
, which detects PHPStan, Psalm, or Phan, and
code formatting with cpx format
, which works with
PHP-CS-Fixer, Laravel Pint, or PHPCBF.
cpx also integrates nicely with Laravel and so your app will be bootstrapped so you can use any Laravel service.
Learn more about this tool at cpx.dev and view the source code on GitHub.
The post Composer Package Executor (CPX) - bring NPX to Composer 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/cpx
The Laravel Optimize DB package provides a good starting point for production-ready SQLite databases. Pest creator and core Laravel team member Nuno Maduro created this package.
This package is meant for SQLite (3.46+) in a Laravel project and works by applying migration to your project and runtime configuration applied via the package's service provider. It applies the following settings at the time of writing:
βββββββββββββββββββββββββββββ¬ββββββββββββββ¬ββββββββββββ
β Setting β Value β Via β
βββββββββββββββββββββββββββββΌββββββββββββββΌββββββββββββ€
β PRAGMA auto_vacuum β incremental β Migration β
β PRAGMA journal_mode β WAL β Migration β
β PRAGMA page_size β 32768 β Migration β
β PRAGMA busy_timeout β 5000 β Runtime β
β PRAGMA cache_size β -20000 β Runtime β
β PRAGMA foreign_keys β ON β Runtime β
β PRAGMA incremental_vacuum β (enabled) β Runtime β
β PRAGMA mmap_size β 2147483648 β Runtime β
β PRAGMA temp_store β MEMORY β Runtime β
β PRAGMA synchronous β NORMAL β Runtime β
βββββββββββββββββββββββββββββ΄ββββββββββββββ΄ββββββββββββ
I won't cover each setting, but the following three settings could potentially have a highly positive impact on SQLite performance.
journal_mode = WAL:
β cache_size = -20000 (20 MB cache):
β mmap_size = 2147483648 (2 GB memory mapping):
The package is considered a work-in-progress, so use it carefully. The package advises not to use it in production yet and to back up your database before requiring it. You can learn more about this package and view the source code on Github.
The post Optimize Your SQLite Database with the Laravel Optimize DB 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/optimize-db-for-laravel-sqlite
Page 3 of 1359