PHP Laravel: Develop a test environment in Laravel with more than 20 Million user rows. (A project in blade laravel and another SPA in vue js infinite scroll)
- GET: http://127.0.0.1:8000/ (Will redirect to login page or dashboard if you are already has verifieh auth)
- GET: http://127.0.0.1:8000/login
- GET: http://127.0.0.1:8000/registration
- GET: http://127.0.0.1:8000/dashboard
- GET: http://127.0.0.1:8000/fakeuser/
- GET: http://127.0.0.1:8000/logout/
- POST: http://127.0.0.1:8000/post-login
- POST: http://127.0.0.1:8000/post-registration
- POST: http://127.0.0.1:8000/api/login/
- POST: http://127.0.0.1:8000/api/users/
- POST: http://127.0.0.1:8000/api/users/:how_many_user_you_want/
- POST: http://127.0.0.1:8000/api/users/:per_page/:page_index/
- Get list of all users and send an email to admin:
php artisan user:fetch
- Insert +20M fake user data/rows:
php artisan user:fake
Rows: 20,022,003
Size: 2.1 GiB
- POST:
/api/login/
; 137.73ms Waiting - POST:
/api/users/50/1/
; 75.08ms Waiting (Maybe database cache, since the first page is so useable) - POST:
/api/users/50/60/
; 174.57ms Waiting
$ php -v
PHP 8.0.7 (cli) (built: Jun 2 2021 04:04:16) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.7, Copyright (c) Zend Technologies
Laravel internally support the "Too Many Attempts" error and not allow clients to send too many requests in a short period of time.
In
app/Http/Kernel.php
Laravel has a default throttle limit for all api routes. [s]
protected $middlewareGroups = [
...
'api' => [
'throttle:60,1',
],
];
$ time curl 'http://localhost:8000/api/users/50/98700/' -H 'Connection: keep-alive' -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"' -H 'Accept: application/json, text/plain, */*' -H 'X-XSRF-TOKEN: eyJpdiI6IkxITWpwdDZOZ2cvR3FLS1dYRjN3eEE9PSIsInZhbHVlIjoiRWg5UnlTU0J3aHVQbUtXSVhyMmZ0UDFlNXhlM2g1RTNKUXMzK0VtMlZza0FvRGxRQnl2MEZoWEVOM21vejhzTXZrL0ZMNlA2R3BmdGVUZkNQcWFqWW45VnJBSnZKU2Vta0RScmQvRGxUVklBK0V3UkpPSCt6SUVCSjEzemllVE8iLCJtYWMiOiI2MzUzMjUyZGY4ZjlkY2ZjYTQ0OWI0YWY4NWVmM2MyM2NjM2ZlMjFhMTUzYTgwNDQwZTA3NmNmMDA3ZGQwMGM1In0=' -H 'User-Sid: undefined' -H 'User-Uid: undefined' -H 'sec-ch-ua-mobile: ?0' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Dest: empty' -H 'Referer: http://localhost:8000/spa/' -H 'Accept-Language: en,fa;q=0.9' -H 'Cookie: _ga=GA1.1.1153724868.1621997033; PHPSID=827472f9a32fd841553ac5ca; _ga_G5D9ZS72L5=GS1.1.1625411801.47.1.1625412299.0; _xsrf=2|2a17c7f5|f3db1a448e0eb035e9fdabbce3701cb5|1625575302; username-localhost-8888="2|1:0|10:1625576831|23:username-localhost-8888|44:NjMzNDZiZjViZGI1NGIwYTgyNzcxOTRhNmNhMTlkMTk=|bff975294e789ed5ae6412429533018bab32a305f46f67decc611cd746f525d9"; XSRF-TOKEN=eyJpdiI6IkxITWpwdDZOZ2cvR3FLS1dYRjN3eEE9PSIsInZhbHVlIjoiRWg5UnlTU0J3aHVQbUtXSVhyMmZ0UDFlNXhlM2g1RTNKUXMzK0VtMlZza0FvRGxRQnl2MEZoWEVOM21vejhzTXZrL0ZMNlA2R3BmdGVUZkNQcWFqWW45VnJBSnZKU2Vta0RScmQvRGxUVklBK0V3UkpPSCt6SUVCSjEzemllVE8iLCJtYWMiOiI2MzUzMjUyZGY4ZjlkY2ZjYTQ0OWI0YWY4NWVmM2MyM2NjM2ZlMjFhMTUzYTgwNDQwZTA3NmNmMDA3ZGQwMGM1In0%3D; laravel_session=eyJpdiI6InNmVXVNaXZtaExDdjU0bE9EY0gxSEE9PSIsInZhbHVlIjoid3lOaW9MWHNUU3lKK29oMTRWNVhkaktvTTBCNUh1RGdwNStCWVZ1ZWtDUzAwVXNRZFpCbHIydXRJOURLWDN0N1dVTDk0dWVvWko1WHg0QTBPeTB5clFMZXFVZ0NRRjREWlZ3ckFtVGVVcitCMU0wUUZxanVPUTlJYlRxeFRFSUoiLCJtYWMiOiJlZjY2ZWJjMjhjMjhmZGIyZWE4ZmNlYjY3NGI5OGEzYmE1M2UzMWVjNGQwOTI1NGI0NjNkMjlhMmMzNmMxNThiIn0%3D' --compressed
real 0m1.179s
user 0m0.010s
sys 0m0.004s
real 0m0.983s
user 0m0.003s
sys 0m0.006s
real 0m1.012s
user 0m0.008s
sys 0m0.007s
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, powerful, and provides tools required for large, robust applications.
Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
If you don't feel like reading, Laracasts can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Patreon page.
- Vehikl
- Tighten Co.
- Kirschbaum Development Group
- 64 Robots
- Cubet Techno Labs
- Cyber-Duck
- Many
- Webdock, Fast VPS Hosting
- DevSquad
- Curotec
- OP.GG
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via taylor@laravel.com. All security vulnerabilities will be promptly addressed.
The Laravel framework is open-sourced software licensed under the MIT license.