I am new to laravel It's good for coding but it is not much faster than codeigniter
I have worked with codeigniter it's page loading is less then 5MB but laravel page loading is probably same to 8MB. i want to work with laravel but i need suggestion to make laravel faster then codeigniter
You have many options to speed up your app :
1- run : php artisan optimize
2- disable the debugger
3- disable the services you don`t use in config.app file
4- if you are using homestead or vagrantBox this adds some shared
folders that slows up the process.
5- if you are working in small,medium size project you can use lumen(lightweight version of laravel).
6-Cache your routes by running : php artisan route:cache
7-Cache your config by running : php artisan config:cache
Some other general tips -relevant to laravel- :
1-If you have data that is frequently fetched for example latest articles in a blog or top scores on a list try implementing a caching layer this would enhance your app performance drastically
2-Queues / back ground jobs , are very useful if you have some processes that take time and could be run in the background for example sending an email, crawling the web
and check out those resources :
https://laracasts.com/discuss/channels/general-discussion/laravel-optimizations-or-speed-ups
http://ionut-bajescu.com/posts/view/improving-your-laravel-application-performance
Is Laravel really this slow?
https://mattstauffer.co/blog/laravel-5.0-route-caching
Related
please I have deployed Laravel project to a cPanel, but when the laravel website is not visited for few hours, I revisited the website and it was loading long before it showed its contents. Is there any way I can use to make the laravel website running always?
I have a Laravel 5.3 project which was created 5 months ago, today I made a duplicate from the project and I made some changes into the code.
When I edit the views in a blade.php file my project which I edited showed me the last project view, I made a new route in the new laravel project and in the routes works well, but still shows the last project view.
It's funny because the js files works pretty well, but the view doens't work. for example, I edit the profile.blade.php file and it shows the content from the last project, if I writte something new in the other view from the last project, it shows in the new project.
Any ideas?
Thanks in advance.
Your views/routes are compiled/cached.
The storage directory contains your compiled Blade templates, file
based sessions, file caches, and other files generated by the
framework.
The bootstrap directory contains files that bootstrap the framework
and configure autoloading. This directory also houses a cache
directory which contains framework generated files for performance
optimization such as the route and services cache files.
Run these commands
php artisan view:clear - Clear all compiled view
php artisan optimize --force - Optimize the framework for better performance
php artisan config:cache - Create a cache file for faster configuration loading
php artisan route:cache - Create a route cache file for faster route registration
Disable opcache from php.ini or use:
ini_set('opcache.enable', 0);
I've moved a laravel app form a domain to another. All works well but I noticed, after clicked on subitting a button, that it spend 20seconds to refresh the paige. During this the system is waiting for an external components (addthis.com, google ads etc..), end when solved the process in console I read the "Blocked: Storage access requests from trackers" message.
I've setup session.php to 'same_site' => 'lax' (it was null..) but nothing happends.
Do you have some idea?
How to include safe url list as walk-artoud it ?
Thanks
Hi after this change you should clear the cache of config laravel
on your console you write :
php artisan config:clear
to permit accept the changes and then clear the cache of your application with
php artisan cache:clear
and see if this works.
I was tried with php artisan optimize:clear with no results, but as you suggest it works right, thank you a lot!
Have I repeat this periodically or only if I update session.php?
What are the steps that need to be done when putting a site from development to production?
I am aware of:
in my .env file set APP_ENV=production
in my .env file set APP_DEBUG=false
I know that the app.js file should be minified even tough i dont know yet what that means..
is there something else that needs to be done?
There is a section about deploying a Laravel application to production in the docs.
To sum it up:
composer install --optimize-autoloader --no-dev, note that if you still want the require-dev packages you can leave off the --no-dev option
php artisan config:cache
php artisan route:cache
php artisan view:cache
You can read more about compiling assets here and about minification here.
Minification is the process of minimizing code and markup in your web
pages and script files. It’s one of the main methods used to reduce
load times and bandwidth usage on websites. Minification dramatically
improves site speed and accessibility, directly translating into a
better user experience. It’s also beneficial to users accessing your
website through a limited data plan and who would like to save on
their bandwidth usage while surfing the web.
You can minify your assets with Laravel Mix the following way:
Mix version 5
// Run all Mix tasks and minify output...
npm run prod
Mix version 6
// Run all Mix tasks and minify output...
npx mix --production
You can read more about the APP_ENV environment variable here:
The current application environment is determined via the APP_ENV
variable from your .env file.
As far as I am aware this does not change much out of the box, but if you use additional third party packages or Laravel packages like for example Telescope, it determines how these packages function, for example if the APP_ENV value is set to local, Telescope will record all data and every user will have access to the Telescope routes.
You can see a example here and here.
There are many things to do to make your site production ready.
Caching (Queries, Views ETC)
Use of webpack (To bundle assets & minify them)
Use cdn for the asset bundles (So they load faster which will increase your website loading speed)
Deploying website on cloud for better resources.
ETC
So you can't just simply make a website production ready by updating your .env file.
You might need to read some articles on google about laravel production ready website
Fairly new to Laravel here and I'm struggling to understand how to make Laravel 5.2 aware of where it resides. Here's the issue:
I set up auth using php artisan make:auth, and can now see the lovely landing page, as well as login and register links in the menu. The problem is that these links don't go to the right place. They point to /login and /register in the code respectively, which translates into http://localhost/login or http://localhost/register. But since I'm not on a production site yet and am developing locally, my website resides at http://localhost/projectname/public.
I've gone into config/app.php and tried various values for the URL parameter, but these have no effect.
What can I do to get these links to reflect the full site URL, without manually entering it each time?
you can run the development server in laravel using this command
php artisan serve
Did you try that?
Use laravel url function:
{{ url().'/login' }}