Home Guest Post How to Getting Started with Laravel in CodeLobster IDE ?

How to Getting Started with Laravel in CodeLobster IDE ?

by Shahriar Sagor

Laravel framework is probably one of the most promoted PHP frameworks at this time. It has a big team and an incredible knowledge basis – numerous articles and video tutorials, and thorough documentation.

Skilled programmers greatly use the laravel app, so even if you are beginner, so you need to learn Laravel asap.

Codelobster allows you to quickly and easily create local Laravel installations. There is no need to use the execute command line on cmd or download and run VirtualBox and Homestead virtual machines that are larger than 2GB.

For installation of laravel using codelobster ide, we require the latest version of our IDE and XAMPP, which in every method is appropriate for the correct process of the latest version of the framework. This article uses XAMPP 7.2.12, and we recommend that you install it as well.

Establish CodeLobster and visit to the main menu “Tools” -> “Preferences” -> “PHP”. Specify need the path to the executable file as “php.exe”, in our system, for example, it looks like this – “D:/xampp-7.2.12/php/php.exe”.

Check “php.ini” file for enabled all the necessary PHP-extensions such as php_bz2, php_curl, php_fileinfo, php_gd2, php_gettext, php_mbstring, php_exif, php_mysqli, php_pdo_mysql, php_pdo_sqlite, php_openssl and php_ftp.

That’s all, everything is ready, let’s start the MySQL with Apache servers and start the leading work.

Laravel Installation using CodeLobster IDE

Visit the main menu of IDE. And open “Project” -> “Create Project”.

In the prompt box that appears, Please choose the type of the app, you want to create.

Laravel in CodeLobster IDE

Select the app name, which we want to place in the “htdocs” folder in the directory with the installed XAMPP.

Allow the option to Create app in a new directory and then click “OK” to start to install process of laravel framework.

Then done some a few phases and join the elementary settings.

Laravel in CodeLobster IDE

To select the system to a current database, select the “Use Database” checkbox and enter the database name, username, and password.

Then the next prompt box, add your server name and port.

All data added by us. Then this IDE will be automatically stored in the laravel app “config/database.php” file. And also, we can changed this details, when we want:

Laravel in CodeLobster IDE

Now following prompt box, we have got an power to select additional official packages for the laravel installation: as follows:

  • Cashier
  • Envoy
  • Horizon
  • Passport
  • Scout
  • Socialite

The above given packages will support to create large app using laravel.

Laravel in CodeLobster IDE

At this time, we need to click on “Finish” and wait for installed the current version of laravel framework and unpacks it into the specified directory.

If the codeLobster wizard has completed its task. To check the correctness of the installation. So open the address “http://localhost/laravel/public/” in your browser, it is in this folder the public files are saved.

Laravel in CodeLobster IDE

As we can see, the Laravel home page is seen in the browser and it has there are no error message, which means everything is fine.

Visit laravel app root directory and open .evn by using this IDE and open the “.env” file in the editor, this file stores the environment variables.

See block of code “DB_CONNECTION=mysql” and add the parameters for linking to MySQL. as follows:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=rootpassword

Check the This Laravel Framework

Laravel includes an object-relational mapping (ORM) system, it is called Eloquent and is an implementation of the Active Record design pattern (AR).If we want to use laravel Eloquent, need to create our own class that extends the “Model” class.

Let’s see how to create a file “Country.php” in the “app” folder and update the following code to it:

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Country extends Model
 {
}

According to the naming rules, a class named “Country” (in the singular) will represent entries in the “Country” table. That’s enough for now, the rest of the work for us will be done by the framework.

To take advantage of the model for the data access, let’s create a router – we will link the URL “http://localhost/laravel/public/countries” to the function of extracting records from the table.

Visit routers directory and open “web.php” file to add or update routes into it:

Route::get('/countries', function () {
    $countries = App\Country::all();
    $html = '<ul>';
	foreach ($countries as $country) {
	  $html .= '<li>' . $country->name . '</li>';
	}
	return $html .= '</ul>';

This IDE knows the design of the Laravel app very nicely and delivers advice to help with all the functions and classes contained in the laravel app.

Laravel in CodeLobster IDE

We can also use advantages of this ide, if we use autocomplete while typing by pressing the Ctrl + Space key combination to get the list of functions that are permitted in this context.

Laravel in CodeLobster IDE

Open web browser and hit following the address into it:

http://localhost/laravel/public/countries
Laravel in CodeLobster IDE
Let’s summarize

In this tutorial, we have learned how to quickly create a new project and install Laravel using the wizard in CodeLobster IDE.

Read Also: How To Implement Laravel 9 form validation ?

Thanks for read. I hope it help you. For more you can follow us on facebook

close

You may also like