Loading...

Follow The Code Developer Programming Blog on Feedspot

Continue with Google
Continue with Facebook
or

Valid

In this tutorial we will show you how to Install Yii With XAMPP On Windows Using Composer step by step. Yii uses Composer, a dependency management tool, as the officially supported method for installation. Through Composer it’s simple and easy to installing latest Yii 2.0 version by running a single command.

To Install Yii With XAMPP On Windows Using Composer, follow the below given steps:

  1. What Is Yii?
  2. Server Requirements
  3. Install XAMPP
  4. Install Composer
  5. Installing Yii
  6. Configuring the Host File in Windows

Let’s get started:

#1. What Is Yii?

Yii is an incredibly reliable, well-designed, high-performing framework for PHP, similar to CakePHP or Laravel.

Currently, there are two Yii 2.0 application templates available:

  • Basic Application Template – a basic frontend application template.
  • Advanced Application Template – consisting of a frontend, a backend, console resources, common (shared code), and support for environments.

In this article we will describe how to install Yii with the Basic Project Template.

The Basic Project Template is fit for developing 90 percent of Web applications. If you are a beginner to Yii, we highly recommended use to the Basic Project Template.

#2. Server Requirements

Before Install Yii using Composer make sure following requirements are enabled and installed on your machine:

1) The minimum PHP version required should be 5.4 or greater. For it we will install XAMPP on Windows.

#3. Install XAMPP

First thing you need to do is download the latest version of XAMPP that supports PHP 7.3.1 and Install it on Windows. For more details, see our step by step guide on How To Download And Install XAMPP On Windows.

#4. Install Composer

The next thing you need to do Install Composer On Windows With XAMPP. This process will take another 5-10 minutes. For more details, see our step by step guide on:

How to Install Composer On Windows With XAMPP

To check the composer installation, Type the following command in command prompt:

composer

#5. Installing Yii2.0 Basic Application Template via composer

To install Yii, First of all, you have to go C:/xampp/htdocs directory, to navigate it type following command in your command prompt:

 cd c:/xampp/htdocs 

Now we are ready to install Yii, run the following command to install latest Yii version:


composer create-project --prefer-dist yiisoft/yii2-app-basic yiiproject

After running this command it should start downloading dependencies that are required to create the Yii project.

This installation may take a few minutes after executing the above command, so wait until you get success message like in the below image.

It installed Yii2 framework to a folder named yiiproject inside the C:/xampp/htdocsdirectory, you can use your own directory name in place of yiiproject (last part in the above command).

When it completed, it will create following directory schema:

Now everything is ready, start the Apache server using the XAMPP control panel.

Finally your Yii2 basic application is now ready, type this URL http://localhost/yiiproject/web/ in your browser and press enter.

#6. Configuring the Host File in Windows

If you want to customize the local browser addresses for your site. To do this, we need to configure a Virtual Host in XAMPP for a Yii project and in this example we want to configure the domain localhost.yiiproject.com for our project. To do so, edit httpd-vhosts.conf file which is located within C:\xampp\apache\conf\extra\httpd-vhosts.conf

Add following code snippet at the end of your file:

 

# VirtualHost for localhost.yiiproject.com
 
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/yiiproject/web"
    ServerName localhost.yiiproject.com  
    <Directory "C:/xampp/htdocs/yiiproject/">
      Options Indexes MultiViews FollowSymLinks
      AllowOverride All
      Require all granted
    </Directory>
</VirtualHost>

After this, apache server is listening to localhost.yiiproject.com connections, but we have to configure our hosts file that allows to redirect localhost.yiiproject.com to the localhost , to do so, edit the hosts file which is located within C:\Windows\System32\drivers\etc

Add following code snippet at the end of your file:

 
127.0.0.1 localhost
127.0.0.1 127.0.0.1
127.0.0.1 localhost.yiiproject.com

After set up Virtual Host in XAMPP, restart the Apache server using the XAMPP control panel, then you can use this URL localhost.yiiproject.com in your browser.

Final Words

That’s it! I hope this article helped you learn to How To Install Yii With XAMPP On Windows Using Composer.

Please feel free to comment below, your suggestion and problems if you face – we are here to solve your problems.

The post How To Install Yii With XAMPP On Windows Using Composer appeared first on The Code Developer.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In this article we will give you a step-by-step guide on how to install Laravel with XAMPP on Windows Using Composer. Through Composer it’s simple and easy to install Laravel with XAMPP.

# Server Requirements

Since we want to work with the latest version of Laravel 5.6, make sure your server meets the following requirements:

  • PHP >= 7.1.3
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension
  • Ctype PHP Extension
  • JSON PHP Extension

For more information, you can check the Server Requirements from Laravel official site.

# Install XAMPP

First thing you need to do is download the latest version of XAMPP that supports PHP 7.3.1 and Install it on Windows. For more details, see our step by step guide on How To Install XAMPP On Windows.

# Composer

Once you have downloaded and installed XAMPP on Windows, then you need to do is Download Composer for Windows and Install it. For more details, see our step by step guide on How to Install Composer On Windows With XAMPP.

Composer is a tool for dependency management in PHP. Laravel utilizes Composer to manage its dependencies. It must installed before setting up Laravel.

Once you successfully installed the Composer, Open Command Prompt from Run box. Press the “Windows+R” key to open RUN dialog box. Type cmd and click on OK.

then type composer and press enter in the Windows terminal then you will get following response like in the below image, it’s means you installed Composer successfully.

# Install Laravel Framework

To install Laravel, First of all, we have to navigate to following directory in your Windows terminal C:/XAMPP/htdocs:

Now Run the following command to install latest Laravel version:


composer create-project --prefer-dist laravel/laravel laravelproject

Note: While run above command maybe you can get encounter a errors like this. 

[ErrorException]
“continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”?

If you installed latest Composer version then you won’t face this issue.

In this case you need update Composer itself to the latest version, run the self-update command. It will replace your composer.phar with the latest version or second option you can reinstall composer.

Once you fixed Composer latest version issue then again run same command in your Windows terminal:

 composer create-project --prefer-dist laravel/laravel laravelproject 

After running this composer command it should start downloading dependencies that are required to create the Laravel project.

After executing this command, it create a folder ‘laravelproject‘ under htdocs with all its dependency which required for Laravel project.

When it completed, it will create following directory schema:

1. Now you need to rename server.php in your Laravel root folder to index.php, in my case laravelproject is my root folder.
2. Copy the .htaccess file from /public directory to your Laravel root folder.

# XAMPP Virtual Host

We need to configure a Virtual Host in XAMPP for a Laravel project and in this example we want to configure the domain localhost.laravelproject.com for our project. To do so, edit httpd-vhosts.conf file which is located within C:\xampp\apache\conf\extra\httpd-vhosts.conf

Add following code snippet at the end of your file:


# VirtualHost for localhost.laravelproject.com

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/laravelproject/"
    ServerName localhost.laravelproject.com  
    <Directory "C:/xampp/htdocs/laravelproject/">
      Options Indexes MultiViews FollowSymLinks
      AllowOverride All
      Require all granted
    </Directory>
</VirtualHost>

After this, apache server is listening to localhost.laravelproject.com connections, but we have to configure our hosts file that allows to redirect localhost.laravelproject.com to the localhost , to do so, edit the hosts file which is located within C:\Windows\System32\drivers\etc

Add following code snippet at the end of your file:


127.0.0.1 localhost
127.0.0.1 127.0.0.1
127.0.0.1 localhost.laravelproject.com

Now everything is ready, restart your XAMPP server and run the http://localhost.laravelproject.com in your browser.

Final Words

That’s it! I hope this article helped you learn to how to install Laravel with XAMPP Using Composer.

Please feel free to comment below, your suggestion and problems if you face – we are here to solve your problems.

The post How to install Laravel with XAMPP on Windows Using Composer appeared first on The Code Developer.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In this article write a C++ Program to print Floyd’s triangle. This Program first takes the numbers of rows and uses nested for loops to print Floyd’s triangle.

C++ Program to print Floyd’s triangle
//C++ program to print Floyd's triangle

#include <iostream>
using namespace std;

int main()
{
    int rows, num = 1;

    cout << "Enter number of rows: ";
    cin >> rows;

    // outer loop is responsible for row
	for(int i = 1; i <= rows; i++)
    {
        
		//inner loop is responsible for columns
		for(int j = 1; j <= i; j++)
        {
            
			// printing number 
		    cout << num << " ";
            num++;
        }
        
		// give line breaks after ending every row
        cout << endl;
    }

    return 0;
}
When the above C++ program is compile and run, this will produce the following result:

The post C++ program to print Floyd’s triangle appeared first on The Code Developer.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Are you looking for a solution how to disable Gutenberg and keep the classic WordPress editor on your WordPress site ? Now the Gutenberg is default editor in WordPress version 5.0. It simply means Gutenberg WordPress editor replaced the classic WordPress editor.

But still many WordPress users are not ready to use it and want to know how to keep the classic editor on my WordPress site? In this article we will explain you how to easily disable Gutenberg and keep the classic editor in WordPress.

What is Gutenberg?

Gutenberg is the project name for the new WordPress block editor, which replaced the WordPress TinyMCE editor as the default WordPress editor in WordPress 5.0. When you open the new WordPress editor for the first time you’re obviously looking for the interface we have all grown habituated to.

While the Gutenberg editor offers an exciting new post and page editing experience. The entire editing experience has been rebuilt for media rich pages and posts.

Why Disable the Gutenberg Editor in WordPress?

There are a few reasons that you may want to disable the WordPress Gutenberg editor for now:

  • You love to work with Classic editor and don’t want to learn a new interface.
  • Your manage sites for clients and you don’t want to force them to learn a new interface.
  • You don’t familiar with the block editor and not going to be ready for the new editor.
Disable Gutenberg and Keep the Classic Editor in WordPress

Let’s take a look at how to easy to disable Gutenberg until you’re not ready for it and keep the classic editor your WordPress site. You can disable the Gutenberg editor entirely or selectively phase it in—the choice is entirely yours.

Method 1 – Install the Classic Editor WordPress Plugin

For this method, we will be using the Classic Editor plugin which is developed and maintained by the core WordPress contributors.

Step 1: Install And Activate The Plugin

To get started, first you need to install the Classic Editor by going to Plugins → Add New and searching for it by name Classic Editor , Then click on Install Now and activate the plugin.

Step 2: Configure Classic Editor Plugin

Once you’ve installed and activated the Classic Editor plugin,  you need to configure whether to:

  • Only use the Classic editor
  • Use both the Classic editor and the Block editor (Gutenberg editor)

To do that, go to Settings → Writing in your WordPress dashboard. Then, look for the Classic editor settings options:

If you chose “Classic Editor” with “No” checkbox option then 100% disable the Gutenberg editor, you’re done!

If you want to chose to switch between Gutenberg and the Classic editor on a post-by-post basis, then you need to choose “Classic Editor” with “Yes” checkbox option.

Method 2 – Install the Disable Gutenberg WordPress Plugin

If you want to disable Gutenberg for certain user roles and post types, then this method will help you do that.

Step 1: Install And Activate The Plugin

To get started, first you need to install the Disable Gutenberg by going to Plugins → Add New and searching for it by name Disable Gutenberg, Then click on Install Now and activate the plugin.

Step 2: Configure Where To Disable Gutenberg

Once you’ve installed and activated the plugin, go to Settings → Disable Gutenberg to configure it. By default, it will disable Gutenberg everywhere.

I hope this article helped you learn how to Disable Gutenberg and Keep the Classic Editor in WordPress..

Please feel free to comment below, your suggestion and problems if you face – we are here to solve your problems.

The post How to Disable Gutenberg and Keep the Classic Editor in WordPress appeared first on The Code Developer.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Security is extremely important for any website or blog, build the trust of your site visitors and for better ranking. So it time to improves your site security with SSL/TLS Certificate. Google announced that switching a website over to the HTTPS would also boost the search engine ranking so you may consider having this for your blog as well.

Many website or blog owner think my site doesn’t have forms or collect information from users.

But It doesn’t matter. HTTPS protects more than just form data! but HTTPS keeps the URLs, headers, and contents of all transferred pages confidential.

In this article you will learn how to install let’s Encrypt Free SSL certificate step by step using zerossl.com installation tool. zerossl.com provide free SSL Tools for your website.

Let’s Encrypt – Free SSL/TLS Certificates

Let’s Encrypt organizations provides free SSL Certificates and a global Certificate Authority (CA). Let’s Encrypt certificates can be used by websites to enable secure HTTPS connections.

How to install Let’s Encrypt in Godaddy or Cpanel

In the below step we will explain you how to install let’s Encrypt Free SSL certificate on your GoDaddy Server (Step by Step) using zerossl.com installation tool –

1. Go to zerossl installation tool.

2. Click on Online Tools button.

3. Click on Start button.

4. On the right-hand side corner, you have a field called “Domains (ONLY if you have NO CSR)”.

Add your own domain name in this text field without include http:// or https://, In my case i added my domain name www.thecodedeveloper.com. Before click Next button accept both terms of services in right side bottom –

Accept ZeroSSL TOS
Accept Let’s Encrypt SA (pdf)

5. Hit Next button in the top right side, then a pop will come and ask – Include www-prefixed version too? Click yes button to continue.

6. Zerossl tool will start generate CSR (Certificate Signing Request).

7. Once generate CSR process completed then copy or download your CSR.

8. Hit Next button in the top right corner,  It’s going to start generating account key, this action might take several minutes.

9. Once generating account key process completed then copy or download your account key and then click on Next button to continue.

10. To verify domain ownership using HTTP verification , you need to download both txt file.

11. In root directory first create a new folder .well-known and inside it create a another folder acme-challenge . So your path should look like this:

“youdomain.com/.well-known/acme-challenge/”

You can learn how to create new folder in cPanel hosting with below steps :
  • Log in to your GoDaddy account.
  • Click Web Hosting.
  • Next to the cPanel account you want to use, click Manage.
  • Click cPanel Admin.
  • Click the File Manager tab.
  • Click +Folder.
  • Complete the on-screen fields, and then click Create New Folder.
  • New folder name should be .well-known.
  • Then create a another folder an acme-challenge inside .well-known folder, sometime after create .well-known folder that folder does not show,  then in this case in left side type public_html/.well-known, click Go button and then continue create acme-challenge folder.

12. Upload the both two .txt files inside the acme-challenge folder, which you downloaded on step 10.

13. After then go back to zerossl tools and click on the highlight link in the screenshot to make sure you uploaded files in right folder.

14. Click on Next button.

15. Now your certificate is ready now, things to do next :

  • Download or copy your domain certificate
  • Download or copy your domain key

16. Go back to cPanel

  • Log in to your GoDaddy account.
  • Click Web Hosting.
  • Next to the cPanel account you want to use, click Manage.
  • Click cPanel Admin.
  • Click SSL/TLS.

17. Click on Manage SSL sites link.

18. Select the domain you want to install the SSL certificate on, you can see i selected my domain thecodedeveloper.com

19. Go back to zerossl, copy the certificate and paste it into first Certificate : (CRT) field in cPanel Admin

20. Cut out the Certificate Authority Bundle from certificate and paste it in the third field –

Once you paste certificate first field then your certificate look like –

——-BEGIN CERTIFICATE——-

some big random string

——-END CERTIFICATE——-

——-BEGIN CERTIFICATE——-

some big random string

——-END CERTIFICATE——-

then you need to cut second part (which start ——-BEGIN CERTIFICATE——- ) till end from first field and paste it in the third field.

21. Go to zerossl and copy private key.

22. In cPanel paste the private key in the second field Private Key (Key)

23. All fields should have 3 green check marks, this means everything matches and now click on Install Certificate button.

24. Your SSL Certificate is now installed, and you can test it after adding https:// to in front of your domain for example https://www.mydomain.com.

In my case i tested https://www.thecodedeveloper.com/

25. If you see the green lock in front of your URL and connection is secure means SSL Certificate install successfully.

I hope you like this Post, Please send me any comment, suggestion or correction you may have – we are here to solve your problems.

The post How to Install Let’s Encrypt Free SSL Certificate on your GoDaddy Server (Step by Step) appeared first on The Code Developer.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In this article we will write a C++ Program to print Inverted half pyramid pattern using asterisk.

C++ Program to print Inverted half pyramid pattern using asterisk
//C++ Program to print Inverted half pyramid using * (asterisk) pattern

#include <iostream>
using namespace std;

int main()
{
   int i, j, row;

   cout << "Enter number of rows: ";
   cin >> row;
   
   // outer loop is responsible for rows
   for(i = row; i >= 1; i--)
   {
      
      //inner loop is responsible for columns
      for(j = 1; j <= i; j++)
      {
         cout << "* ";
      }
      
	  // give line breaks after ending every row
	  cout << "\n";
   }

   return 0;
}
When the above C++ program is compile and run, this will produce the following result:

The post C++ Program to print Inverted half pyramid pattern using * (asterisk) appeared first on The Code Developer.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In this article write a C++ Program to print half pyramid pattern using alphabets.

C++ Program to print half pyramid pattern using alphabets
// C++ Program to print half pyramid pattern using alphabets
#include <iostream>
using namespace std;

int main()
{
    char input, alphabet = 'A';
    int i, j;

    cout << "Enter the uppercase character you want to print in the last row:";
    cin >> input;
     
	 // outer loop is responsible for rows
    for(int i = 1; i <= (input-'A'+1); i++)
    {
        
		//inner loop is responsible for columns
		for(int j = 1; j <= i; j++)
        {
            cout << alphabet << " ";
        }
        alphabet++;
        
		// give line breaks after ending every row
        cout << "\n";
    }
    return 0;
}
When the above C++ program is compile and run, this will produce the following result:

The post C++ Program to print half pyramid pattern using alphabets appeared first on The Code Developer.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In this article write a C++ Program to print half pyramid pattern using numbers.

C++ Program to print half pyramid pattern using numbers
//C++ Program to print half pyramid pattern using numbers

#include <iostream>
using namespace std;

int main()
{
    int rows, i, j;

    cout << "Enter number of rows: ";
    cin >> rows;

    // outer loop is responsible for row
	for(i = 1; i <= rows; i++)
    {
        //inner loop is responsible for columns
	    for(j = 1; j <= i; j++)
        {
            cout << j << " ";
        }
        // give line breaks after ending every row
		cout << "\n";
    }
    return 0;
}
When the above C++ program is compile and run, it will produce the following result:

The post C++ Program to print half pyramid pattern using numbers appeared first on The Code Developer.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In this article write a C++ Program to print half star pyramid pattern.

// C++ Program to print half star pyramid pattern

#include <iostream>
using namespace std;

int main()
{
    int rows;

    cout << "Enter number of rows:";
    cin >> rows;

    // outer loop to handle number of rows
	for(int i = 1; i <= rows; i++)
    {
        // print * equal to row number
		for(int j = 1; j <= i; j++)
        {
            // printing stars
		    cout << "* ";
        }
        // line breaks
		cout << "\n";
    }
    return 0;
}

The post C++ Program to print half star pyramid pattern appeared first on The Code Developer.

Read Full Article
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

In this article you will learn how to merge two or more arrays into one array in PHP. You can easily do it after use array_merge() function to merge the elements or values of two or more arrays together into a single array.

array_merge() function

The array_merge() function merges one or more arrays into one array. Note: If two or more array elements have the same key, the last one overrides the others.

Merge two or more arrays into one array in PHP
<?php
$array1 = array("yellow", "red", "green", "orange", "purple");
$array2 = array("pink", "brown", "green", "orange", "red");
$array  = array_merge($array1, $array2);
print_r($array);
?>
The above example will output:
Array
(
    [0] => yellow
    [1] => red
    [2] => green
    [3] => orange
    [4] => purple
    [5] => pink
    [6] => brown
    [7] => green
    [8] => orange
    [9] => red
)

The post How to merge two or more arrays into one array in PHP ? appeared first on The Code Developer.

Read Full Article

Read for later

Articles marked as Favorite are saved for later viewing.
close
  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Separate tags by commas
To access this feature, please upgrade your account.
Start your free month
Free Preview