Laravel Fundamentals Flashcards

(25 cards)

1
Q

What is Laravel?

A

Laravel is an open-source PHP framework for building modern web applications using the MVC pattern.

Laravel simplifies PHP development with tools like Eloquent ORM and Blade templating, much like WordPress simplifies content management. Freelancers use Laravel for custom apps, while enterprise architects leverage its structure for scalable systems, aligning with your PHP and WordPress experience.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you install Laravel?

A

Use Composer with composer create-project laravel/laravel myapp.

This installs Laravel in a directory (e.g., myapp), similar to downloading WordPress. You need Composer, like XAMPP for PHP. Freelancers set up projects, while enterprise architects automate installations, per your LAMP deployment knowledge.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Composer in Laravel?

A

Composer is a PHP dependency manager used to install Laravel and its packages.

Like WordPress plugins, Composer manages libraries (e.g., guzzlehttp/guzzle). Your familiarity with array_merge() suggests comfort with dependencies. Freelancers use Composer for project setup, while enterprise architects ensure version control.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the .env file in Laravel?

A

The .env file stores environment-specific settings, like DB_DATABASE=mydb.

Similar to WordPress’s wp-config.php, it configures database and app settings. Freelancers customize .env for clients, while enterprise architects secure it (e.g., chmod 600), per your WordPress on LAMP deck.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the Laravel directory structure?

A

Laravel’s structure includes app/, routes/, config/, public/, and resources/.

app/ holds models, routes/ defines URLs, like WordPress’s wp-content. Your PHP experience aids navigation. Freelancers organize code, while enterprise architects standardize structures for large projects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the app/ directory in Laravel?

A

The app/ directory contains core application code, like models and controllers.

Like WordPress’s wp-includes, it’s the app’s backbone. Freelancers add custom logic here, while enterprise architects maintain modular code, per your PHP OOP deck.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the routes/ directory in Laravel?

A

The routes/ directory defines application routes, like web.php for web routes.

Similar to WordPress permalinks, it maps URLs to actions. Freelancers define routes, while enterprise architects group them for scalability, per your PHP APIs deck.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is Artisan in Laravel?

A

Artisan is Laravel’s CLI tool, run with php artisan.

Like WordPress’s WP-CLI, it automates tasks (e.g., php artisan make:model). Freelancers use Artisan for efficiency, while enterprise architects script commands, per your LAMP deployment experience.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you create a controller with Artisan?

A

Use php artisan make:controller MyController.

Generates a controller file in app/Http/Controllers. Similar to creating WordPress plugin functions. Freelancers build controllers, while enterprise architects ensure naming conventions, per your PHP functions deck.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the MVC pattern in Laravel?

A

MVC (Model-View-Controller) separates data (Model), presentation (View), and logic (Controller).

In WordPress, plugins mix logic; Laravel organizes it clearly. Freelancers use MVC for clean code, while enterprise architects leverage it for scalability, per your PHP OOP knowledge.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a Laravel model?

A

A model represents a database table, defined in app/Models, like class User extends Model {}.

Like WordPress’s $wpdb for posts, models handle data. Freelancers create models, while enterprise architects define relationships, per your PHP database deck.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the public/ directory in Laravel?

A

The public/ directory is the web server’s document root, containing index.php.

Like WordPress’s root, it’s Apache’s entry point. Freelancers place assets here, while enterprise architects secure it, per your Apache configuration deck.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the config/ directory in Laravel?

A

The config/ directory stores configuration files, like app.php or database.php.

Similar to WordPress’s wp-config.php, it centralizes settings. Freelancers customize configs, while enterprise architects manage environments, per your LAMP integration deck.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you run a Laravel application locally?

A

Use php artisan serve to start a development server at http://localhost:8000.

Like XAMPP for WordPress, it tests apps locally. Freelancers use it for development, while enterprise architects prefer production servers, per your XAMPP experience.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the vendor/ directory in Laravel?

A

The vendor/ directory contains Composer-installed dependencies and the autoloader.

Like WordPress’s wp-content/plugins, it holds external libraries. Freelancers manage dependencies, while enterprise architects ensure compatibility, per your PHP advanced techniques deck.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is Laravel’s index.php file?

A

The index.php file in public/ is the entry point, bootstrapping the application.

Similar to WordPress’s index.php, it routes requests. Freelancers protect it, while enterprise architects optimize bootstrapping, per your WordPress on LAMP deck.

17
Q

What is the bootstrap/ directory in Laravel?

A

The bootstrap/ directory initializes Laravel, containing app.php and cache files.

Prepares the app, like WordPress’s wp-load.php. Freelancers rarely edit it, while enterprise architects optimize initialization, per your PHP core concepts.

18
Q

How do you configure the database in Laravel?

A

Set database credentials in .env, like DB_CONNECTION=mysql and DB_DATABASE=mydb.

Connects Laravel to MySQL, like WordPress’s wp-config.php. Freelancers configure connections, while enterprise architects secure credentials, per your MySQL deck.

19
Q

What is Laravel’s app.php configuration file?

A

The config/app.php file sets app-wide settings, like timezone or locale.

Customizes Laravel, like WordPress settings. Freelancers adjust settings, while enterprise architects standardize for global apps, per your LAMP integration deck.

20
Q

What is a service provider in Laravel?

A

A service provider registers services, defined in app/Providers, like AppServiceProvider.

Like WordPress hooks, providers bind functionality. Freelancers create providers, while enterprise architects manage dependencies, per your PHP OOP deck.

21
Q

How do you clear Laravel’s cache?

A

Use php artisan cache:clear or php artisan config:clear.

Resets cached configs, like clearing WordPress transients. Freelancers clear caches, while enterprise architects automate cache management, per your performance deck.

22
Q

What is Laravel’s routes/web.php file?

A

The routes/web.php file defines web routes, like Route::get(‘/’, [HomeController::class, ‘index’]);.

Maps URLs, like WordPress permalinks. Freelancers define routes, while enterprise architects organize them, per your PHP APIs deck.

23
Q

What is Laravel’s routes/api.php file?

A

The routes/api.php file defines API routes, prefixed with /api, like Route::get(‘/users’, [ApiController::class, ‘index’]);.

Handles WordPress-like API requests. Freelancers build APIs, while enterprise architects secure them, per your WordPress APIs deck.

24
Q

How do you generate a Laravel application key?

A

Use php artisan key:generate to set APP_KEY in .env.

Secures Laravel, like WordPress’s security keys. Freelancers generate keys, while enterprise architects ensure unique keys, per your security deck.

25
What is the Laravel welcome page?
The welcome page is a default view at resources/views/welcome.blade.php, displayed at the root URL. Like WordPress’s default homepage, it’s a starting point. Freelancers customize it, while enterprise architects replace it with app views, per your WordPress theme development skills.