Created
December 20, 2019 10:52
-
-
Save wolfsyntax/e1acb272ba81e1fd495add78d4dd116d to your computer and use it in GitHub Desktop.
Laravel Cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Environment Variables | |
In a fresh Laravel installation, the root directory of your application will contain a .env.example file. Rename the file .env.example to .env | |
- Environment Variable Types | |
.env Value env() Value | |
true (bool) true | |
(true) (bool) true | |
false (bool) false | |
(false) (bool) false | |
empty (string) '' | |
(empty) (string) '' | |
null (null) null | |
(null) (null) null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Getting Started | |
1. Installation | |
2. Configuration | |
3. Routing | |
4. Middleware | |
5. CSRF Protection | |
6. Controllers | |
7. Views | |
8. URL Generation | |
9 . Session | |
10. Validation | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Laravel utilizes Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine. | |
Requirements: | |
- PHP / Apache | |
- Database (MySQL, Oracle, SQLite, PostgreSQL or MongoDB) | |
- Text Editor (i.e. [VS Code, Notepad++], [Sublime Text, PHPStorm]) | |
* Composer (https://getcomposer.org/download/) | |
* INTERNET Connection | |
After you installed Composer, you may download the Laravel Installer via Composer by executing this command: | |
$ composer global require laravel/installer | |
Once you have successfully installed Laravel, make sure to place Composer's system-wide vendor bin directory in your $PATH so the laravel executable can be located by your system. This directory exists in different locations based on your operating system; | |
You can do that by adding this to your PATH: | |
%USERPROFILE%\AppData\Roaming\Composer\vendor\bin | |
or run this command: | |
$ setx path "%path%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin" | |
Once installed, the laravel new command will create a fresh Laravel installation in the directory you specify | |
$ laravel new <project_name> | |
Alternatively, you may also create a Laravel by issuing the Composer create-project command in your terminal: | |
$ composer create-project --prefer-dist laravel/laravel <project_name> | |
Local Development Server | |
If you have PHP installed locally and you would like to use PHP's built-in development server to serve your application, you may use the serve Artisan command. | |
This command will start a development server at http://localhost:8000: | |
$ php artisan serve | |
In case this command is NOT working, you may use this to use PHP's built-in development server: | |
$ php -S 127.0.0.1:8000 -t public\ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment