Category: PHP

In a previous post I mentioned how Symfony offers a collection of decoupled components, which can be a benefit when you do not wish to commit to a full-fledged framework. Recently, however, I needed to quickly create a PHP application for a work project and decided to use Laravel – the most popular PHP framework – as I knew I could get it up and running quickly.

Here are my very brief notes on how to do so in a Windows server environment:

Composer is a dependency management tool that will allow you to install components in PHP.

Note that during the installation it will allow you to choose the command line PHP you want to use. Mine correctly defaulted to the PHP installation within my Wamp directory. If it does not do so or if you have installed Wamp on another drive, you will want to navigate to php.exe that is located within your Wamp folder.

Finally, create the Laravel project for your application.

The easiest way to do so is to open a command prompt, navigate to the www folder within your wamp directory, and enter the following:

composer create-project –prefer-dist laravel/laravel myproject

Change the ‘my project’ name to whatever you wish to call your application. (Note: the dash before ‘prefer’ in the above command line should be a double dash; WordPress is converting it to an em-dash.)

After that, from the command line you can navigate to your new project directory and verify the installation with the following command:

This is the second of my posts documenting how I configured the PHP Symfony framework for Windows. For work, I needed to connect my Symfony installation to SQL Server. There are two steps to do so: install the driver and update the configuration settings.

I recently had to install Symfony, the PHP component-based framework, for a work project. There is extensive documentation on the Symfony site, however I thought I would post a quick start guide with the essential steps for getting Symfony up and running quickly on a Windows server environment.

Why Symfony?

I chose Symfony because it was the least framework-like method for structuring a PHP application. In reading Josh Lockhart’s ‘Modern PHP’ this past year, he notes that the problem in choosing a traditional framework is that you are committing to that framework’s future. Additionally, frameworks have a wide variety of tools, but sometimes you just need something specific, which the framework may not provide. Symfony, on the other hand, is a collection of decoupled components that can be used in isolation or as part of a framework.

Installation Steps

The easiest way that I found to install Symfony is with Composer, the dependency management tool for PHP.

There are three steps: install Composer, create a Symfony project, and start the server.

1. Go to the Composer site and download and run the application via the executable.

2. Open a Windows command prompt and enter the following command (change ‘project_name’ to whatever you want to call your project):

Composer will then execute a series of commands. At some point it will ask you for database credentials. You can hit enter for each one to leave them at their defaults initially. Of course, before moving to a production environment you will want to change these.

Eventually, you will get a message saying all assets were successfully installed.

3. Finally, navigate to your directory and start the server with the following two commands (for ‘project_name’ enter whatever you named your project in step two):

cd project_name/

php bin/console server:run

Symfony should now be installed. You can verify this by pulling up http://localhost:8000/ in your browser, where you will get a Symfony welcome message.