Using VSCode DevContainers with Hazaar
Using VSCode DevContainers with Hazaar
The easiest way to get started with Hazaar is by using the Visual Studio Code Dev Containers extension. This sets up a complete development environment for you, with all dependencies installed and ready to go.
The Hazaar example application is pre-configured for Dev Containers. It includes a Dockerfile
and a .devcontainer
directory for container configuration, based on the FrankenPHP image. This provides a web server suitable for both development and production.
Tips
For more on FrankenPHP and Hazaar integration, see the FrankenPHP documentation.
1. Prerequisites
Make sure you have the following installed:
2. Clone the Example Application
Clone the Hazaar example application using Git:
git clone https://git.hazaar.io/hazaar/hazaar myapp
This creates a new myapp
directory with the application code and example configuration.
3. Open in VSCode and Launch the Dev Container
- Open the
myapp
folder in Visual Studio Code. - When prompted by the Dev Containers extension, click Reopen in Container.
This will:
- Build and start the development container
- Install all required dependencies
- Launch a web server for your application
Note: The first build may take a few minutes depending on your system and internet speed.

4. Install Composer Dependencies
Once the container is running, you must install PHP dependencies with Composer. VSCode will usually prompt you to do this—click Install when prompted.
Alternatively, open a terminal in the container and run:
composer install

5. Run and View the Application
After installing dependencies, your application is ready! Open your browser and go to http://localhost:8000 to see the example app running.

6. Example Application
The example application provides a working starting point, including:
- Application and public directories
- Example code and configuration
- Dev Container setup for rapid development

What's Next?
- Configuration – Learn how to configure your application.
- Routing – Understand routing in Hazaar.
- Controllers – Create controllers for your app.
- Views – Build views for your app.
- Models – Work with models.
- Database – Use databases in your app.
If you have questions or run into issues, check the FAQ or reach out via the contact page.