アプリ関連ニュース
- 2021年3月03日
- 他の話題
組み換え可能なノートパソコンが登場
tanaka at 2021年03月03日 10:00:31
- 2021年3月01日
- 技術情報
Optimize Laravel website speed
Today, I would like to highlight a laravel package that will hep you to speed up your laravel website.
It is very important for every website to quick load that means your website should load in few seconds like 4 or 5. We are always fetching issues about page speed like how to increase website speed in laravel, how to reduce loading time of website in laravel, is it possible speed up php execution time of my website, how to optimize php laravel script to increase speed, how to speed up web browsing in laravel. So basically you have several question regarding to improve your website performance.
I found “laravel-page-speed” composer package for 35%+ optimization of laravel website. laravel-page-speed package will minify HTML output and it can be optimization your web page. laravel-page-speed package will delete unused attributes in HTML tags, delete unused quotes in HTML tags, delete unused prefixes from URLs, delete unused whitespace in HTML, delete HTML comments. Also there are several feature. They also minify css and minify js files.
Just grab the package via composer.
composer require renatomarinho/laravel-page-speed
Publish the configuration file
php artisan vendor:publish --provider="RenatoMarinho\LaravelPageSpeed\ServiceProvider"
And then register it in Kernel file
//app/Http/Kernel.php
protected $middleware = [
...
\RenatoMarinho\LaravelPageSpeed\Middleware\InlineCss::class,
\RenatoMarinho\LaravelPageSpeed\Middleware\ElideAttributes::class,
\RenatoMarinho\LaravelPageSpeed\Middleware\InsertDNSPrefetch::class,
\RenatoMarinho\LaravelPageSpeed\Middleware\RemoveComments::class,
//\RenatoMarinho\LaravelPageSpeed\Middleware\TrimUrls::class,
//\RenatoMarinho\LaravelPageSpeed\Middleware\RemoveQuotes::class,
\RenatoMarinho\LaravelPageSpeed\Middleware\CollapseWhitespace::class, // Note: This middleware invokes "RemoveComments::class" before it runs.
\RenatoMarinho\LaravelPageSpeed\Middleware\DeferJavascript::class,
]
And you are good to go.
There are several useful filtering methods that will help you to speed up your website like `RemoveComments, CollapseWhitespace, RemoveQuotes` etc.
You can see more detail in their documentation.
By Yuuma
yuuma at 2021年03月01日 11:00:13
[HTC VIVE + Unity] レーザーポインターの実装方法 (4)
HTC VIVE用VRアプリ開発でUnityを使用してレーザーポインターを実装する方法を紹介します。
本記事は前回の「[HTC VIVE + Unity] レーザーポインターの実装方法 (3)」の続きです。
今回は、前回追加したレーザーポインターに衝突判定処理を追加する方法を紹介します。
nishida at 2021年02月26日 10:00:36
Laravel Date Filtering
I would like to talk about the date filtering process I am using in laravel today.
If we want to select records that is created today. We can normally use raw queries or without raw queries like this.
//Raw Query
Model::where(DB::raw("DATE(created_at) = '".date('Y-m-d')."'"))->get();
//Not Raw Query
Model::where('created_at', '>=', date('Y-m-d').' 00:00:00'))->get();
In fact, we can do more neat and eloquent way in laravel like this.
Model::whereDate('created_at', '=', date('Y-m-d'))->get();
We can also use Carbon function instead of date(), result will still the same.
Model::whereDate('created_at', '=', Carbon::today()->toDateString())->get();
If you want to filter just not with full date, it’s totally fine. You can filter with day, month and year like this.
//Day
Model::whereDay('created_at', '=', date('d'))->get();
//Month
Model::whereMonth('created_at', '=', date('m'))->get();
//Year
Model::whereYear('created_at', '=', date('Y'))->get();
There is also another method called `whereBetween` if you want to filter by date range.
Model::whereBetween('created_at', [FROM_DATE, TO_DATE])->get();
By Yuuma
yuuma at 2021年02月22日 11:00:59
- 2021年2月17日
- Linux
ラズベリーパイOSをPC上で動かしてみました
PCにインストール可能なRaspberryPi用のOS(Raspberry Pi Desktop for PC)があります。
今回はこのOSを VirtualBox上の仮想PC にインストールしてみます。
tanaka at 2021年02月17日 10:00:33