Installing the latest stable version of CakePHP (version 5.3+) using Laragon on Windows 11 is straightforward. CakePHP 5 requires PHP 8.1 to 8.5 and specific PHP extensions enabled. Laragon makes it easy to set this up.
Here is the step-by-step guide to getting it up and running.
Step 1: Verify PHP Version & Requirements
CakePHP 5.x requires a modern version of PHP and a few specific extensions.
- Check PHP version: Open Laragon, right-click anywhere in the interface, and go to PHP -> Version. Ensure you are running PHP 8.1 or higher (PHP 8.2 or 8.3 is ideal).
- Enable Required Extensions: Right-click the Laragon interface, navigate to PHP -> Extensions, and make sure the following are checked/enabled:
intl(Crucial for CakePHP)mbstringopensslpdo_mysql(or whichever database you plan to use)
Step 2: Open Laragon's Terminal
Laragon comes with a pre-configured terminal that has php and composer already built into its environment variables.
- Click the Terminal button on the main Laragon panel.
- By default, it will open to your root web directory:
C:\laragon\www\.
Step 3: Create the CakePHP Project
In the terminal, run the standard Composer command to create a new CakePHP project. Replace my_cake_app with whatever you want to name your project folder:
composer create-project --prefer-dist cakephp/app:^5.3 my_cake_app
Note: Specifying
^5.3ensures Composer grabs the latest stable release of the CakePHP 5 branch.
During the installation, the installer will ask you a permission prompt:
- Set Folder Permissions? (y/N) -> Type y and press Enter.
Step 4: Configure Your Database (Optional but Recommended)
Laragon automatically generates a clean local database for you, or you can use its MySQL instance.
- Open your new project folder:
C:\laragon\www\my_cake_app. - Navigate to config and open
app_local.php. - Scroll down to the
'Datasources'array and update your connection info. Out of the box, Laragon's default MySQL configuration is:
- username:
root - password: (leave empty
'') - database:
my_cake_app(Make sure to create this database in Laragon using phpMyAdmin or HeidiSQL)
Step 5: Access Your App
Laragon features an automatic Auto Virtual Hosts mechanism.
- Click Stop on Laragon, and then click Start All to refresh the server configuration.
- Open your web browser and go to:
http://my_cake_app.test
You should see the bright red/gray CakePHP welcome page confirming that your environment is properly set up!
No comments:
Post a Comment