If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.

Laravel 11 Updates
Agar आप PHP और Laravel का इस्तेमाल करते हैं, तो Laravel 11 का launch आपके लिए एक बड़ा update है! Laravel 10 के बाद, इस नए version में performance improvements, developer-friendly features, और simplified code structure लाया गया है।
चलिए जानते हैं कि Laravel 11 में क्या-क्या नया है, और ये आपके projects के लिए क्यों ज़रूरी है।
●●●
पहले नया Laravel project बनाते time, बहुत सारी default files (जैसे Kernel.php, Exception Handler) create होती थीं, जिनकी ज़्यादातर developers को ज़रूरत नहीं होती।
अब नया project create करने पर कम files generate होंगी, जिससे Project structure clean और lightweight हो गया है।
Example
app/Http/Kernel.php अब automatically framework में include है।
bootstrap/app.php को simplify किया गया है।
Laravel 11 में एक नया /up route add किया गया है, जो आपके app की health check करता है। ये route check करता है -
Cache driver
Database Connection
Queue workers
कैसे Use करें?
बस browser में खोलें : https://yourapp.com/up , अगर सब कुछ ठीक है, तो "OK" दिखेगा।
पहले rate limiting केवल per-minute basis पर होती थी। Laravel 11 में अब आप seconds में भी limit set कर सकते हैं।
// API routes पर 10 requests per second
RateLimiter::for('api', function (Request $request) {
return Limit::perSecond(10);
}); इससे APIs को और secure बनाने में मदद मिलती है।
Model में $casts array को अब method के रूप में define किया जा सकता है।
In Laravel 10
protected $casts = [
'birthday' => 'date',
'metadata' => 'array',
]; In Laravel 11
public function casts(): array
{
return [
'birthday' => 'date',
'metadata' => 'array',
];
} अब आप event listeners को सिर्फ एक बार execute कर सकते हैं।
Event::once(function (OrderShipped $event) {
// ये code सिर्फ एक बार चलेगा
}); Laravel 11 को चलाने के लिए अब PHP 8.2 ज़रूरी है। इसके साथ आप PHP 8.2 के नए features जैसे readonly classes और array_is_list() का भी use कर सकते हैं।
php artisan make:class → नई class create करें।
php artisan schema:dump → Database schema को dump करने के लिए।
Loading ...