Introduction
Dalira is a lightweight PHP framework designed for developers seeking an elegant syntax and rapid runtime performance for development tasks. It promotes a clean separation of concerns, enhancing the organization and maintainability of web applications.
The framework handles data logic and database interactions, ensuring a clear structure for data management. It also manages the presentation layer, allowing developers to create dynamic and user-friendly interfaces without cluttering business logic. This simplicity and efficiency make Dalira an ideal choice for building robust web applications.
Getting Started
To begin using Dalira, download the framework here. Familiarize yourself with its file structure and core components to leverage its capabilities effectively. First, there is a requirement you should meet:
File Structure
The directory is organized to facilitate efficient development and maintainability.
dalira-template/
├── app/ ← Application directory
│ ├── layout/ ← Directory for headers and footers
│ └── models/ ← Directory for CRUD operations
├── config/ ← Configuration directory
└── public/ ← Public directory
├── css/ ← Directory for CSS files
├── img/ ← Directory for images
└── js/ ← Directory for JS files
Starter Template
Create a new filename.php file in the root project. Include the header.php and footer.php files from a specified directory using their absolute paths. This method ensures that the files are included regardless of the current directory, allowing for consistent page structure.
<?php include realpath(__DIR__ . '/app/layout/header.php') ?>
<h1>Hello world!</h1>
<?php include realpath(__DIR__ . '/app/layout/footer.php') ?>
CSS & JS Components
Dalira utilizes Bootstrap 5.0.2 as its primary styling framework. This allows for a responsive and modern design, leveraging Bootstrap's grid system and components.
To modify the styling or update the Bootstrap version, you can make changes in the header.php and the footer.php file.
Steps to Change Bootstrap Version or Customize Styles
1. Locate header.php
- Look for the link to the Bootstrap CSS file, which typically appears as shown in the code below. You can either change or update it, or replace it with another CSS framework.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css">
2. Locate footer.php
- Locate the Bootstrap-related script, typically formatted as shown in the code below. This script is essential for Bootstrap's JavaScript functionality, and you can update it or replace it with another framework as needed.
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js"></script>