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.
Read more https://build.prestashop-project.org/news/2023/upcoming-live-update-9-2023/
The jenssegers-agent package is a desktop/mobile user agent parser with support for Laravel, based on MobileDetect. You can use this package in any PHP application, and it also provides a Laravel service provider, giving you a service Facade:
use Jenssegers\Agent\Facades\Agent;
Agent::is('Firefox');
Agent::is('iPhone');
// Magic methods
Agent::isFirefox();
Agent::isIPhone();
// Device type
Agent::isDesktop();
Agent::isMobile();
Agent::isTablet();
Agent::isPhone();
Besides user agent helpers, the Agent service provides a language helper, device name method, platform, and more. For example, you could get the accepted browser languages using the following method:
Agent::languages(); // ['en-us', 'en']
Using the languages method, you could set the locale during a request in a middleware. Here's a simple example just to illustrate just off the top of my head:
public function handle(Request $request, Closure $next): Response
{
$supported_locales = ['en', 'es'];
$user_locales = Agent::languages();
foreach ($user_locales as $locale) {
if (in_array($locale, $supported_locales)) {
app()->setLocale($locale);
}
}
return $next($request);
}
If you do not support the locale, the
config('app.fallback_locale')
setting will define the
locale. You might also use the languages()
method in
middleware to redirect a locale-specific route prefix
/{locale}/
based on the user agent's supported
language.
Route::prefix('/{locale}')->group(function () {
// ...
})->whereIn('locale', ['en', 'es']);
The Agent
service can also determine if the current
user agent is a bot and what type of bot:
// Is the user a bot?
Agent::isRobot(); // bool
// get the robot name
Agent::robot();
Lastly, to get the device name, platform, and browser, you can use the aptly named methods on the facade:
Agent::device(); // "Macintosh"
Agent::platform(); // "OS X"
Agent::browser(); // "Safari"
The post Desktop and Mobile User Agent Parser 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/php-desktop-and-mobile-user-agent-parser
Your domain is the lifeblood of your online presence. For the last few months, we’ve been hard at work building a number of exciting features to ensure a world-class domain name experience on WordPress.com whether you have one domain or one hundred!
Below, we highlight a handful of new enhancements in how you manage and organize your domains on our platform.
Get your domain name todayOne of the first things you’ll notice is the stunning visual overhaul of the domain management dashboard. We’ve made significant improvements to make it more intuitive and enjoyable, especially for those of you with multiple domains.
You can now secure your domain(s) for multiple years at a time, all the way up to ten years for most TLDs. Remember, you don’t need to have a website with WordPress.com to house your domain with us.
This feature is perfect for folks who want to utilize a unique domain name that will lead visitors to a specific site or page. Forwarding your domain or subdomain can be used for a number of purposes:
Learn more about domain forwarding.
If you’re looking to transfer a domain to another WordPress.com user, there’s no need to reach out to our Happiness Engineers. Do it yourself with a single click from the transfer settings page.
Learn more about domain transfers.
We’ve made it easier than ever to manage multiple domains. With our latest update, you can now perform bulk updates, like setting auto-renewal options or updating your contact details. No more clicking through to individual domain management pages.
With every domain transferred to us, we attempt to discover and import your DNS records automatically to make sure your website, email, and other services continue working as expected after the domain transfer is complete. We also allow you to import all your DNS records using our new BIND file imports. Both those features are available to you to allow a smooth transfer of your domain. We still recommend all our users check and confirm all their DNS records were imported successfully to avoid any service interruptions.
We can’t wait for you to try out these feature upgrades yourself. If you have domains with us already, visit your dashboard:
Manage your domain(s)If you need a new domain, get started here:
Get your domain name todayAnd if you have a domain to transfer from Google or Squarespace, we’ll cover the fees for you and provide an extra year of registration. Learn more and get started here.
Thank you for choosing us as your trusted domain hosting provider. We’re excited to continue supporting your online journey and helping you make a lasting impact on the web.
Read more https://wordpress.com/blog/2023/10/05/domains-improvements/
Opening Hours is a PHP package by Spatie to query and format a set of business operating hours. You can use it to present the times per day and include exceptions for things like holidays and other days off on a given year-specific date or recurring (happening each year). The project's readme file has this example to illustrate how you can configure hours:
$openingHours = OpeningHours::create([
'monday' => ['09:00-12:00', '13:00-18:00'],
'tuesday' => ['09:00-12:00', '13:00-18:00'],
'wednesday' => ['09:00-12:00'],
'thursday' => ['09:00-12:00', '13:00-18:00'],
'friday' => ['09:00-12:00', '13:00-20:00'],
'saturday' => ['09:00-12:00', '13:00-16:00'],
'sunday' => [],
'exceptions' => [
'2016-11-11' => ['09:00-12:00'],
'2016-12-25' => [],
'01-01' => [], // Recurring on each 1st of January
'12-25' => ['09:00-12:00'], // Recurring on each 25th of December
],
]);
// This will allow you to display things like:
$now = new DateTime('now');
$range = $openingHours->currentOpenRange($now);
if ($range) {
echo "It's open since ".$range->start()."\n";
echo "It will close at ".$range->end()."\n";
} else {
echo "It's closed since ".$openingHours->previousClose($now)->format('l H:i')."\n";
echo "It will re-open at ".$openingHours->nextOpen($now)->format('l H:i')."\n";
}
This package has tons of configuration options and can be used on any PHP project without any dependencies. While this package isn't a brand-new Spatie package, we've never covered it and think you should check it out! You can get setup instructions and see more API examples on GitHub at spatie/opening-hours.
If you'd like to learn more background information on why this package as created, Freek Van der Herten originally wrote about it on his blog: Managing opening hours with PHP.
The post Configure and Display a Schedule of Opening Hours in PHP 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/scheduled-opening-hours-in-php
Read more https://build.prestashop-project.org/news/2023/do-you-speak-prestashop-september-2023/