Codeigniter 4 Project Structure

No Comments
bike_autoparts/
│
├── app/
│   ├── Config/
│   │   ├── Auth.php
│   │   ├── Filters.php
│   │   ├── Routes.php
│   │   └── ...
│   │
│   ├── Controllers/
│   │   ├── Admin.php
│   │   ├── AdminCategory.php
│   │   ├── AdminUser .php
│   │   ├── Auth.php
│   │   ├── Product.php
│   │   ├── Profile.php
│   │   ├── Wishlist.php
│   │   └── ...
│   │
│   ├── Database/
│   │   ├── Migrations/
│   │   │   ├── create_users_table.php
│   │   │   ├── create_categories_table.php
│   │   │   ├── create_products_table.php
│   │   │   ├── create_reviews_table.php
│   │   │   ├── create_email_verifications_table.php
│   │   │   ├── create_password_resets_table.php
│   │   │   ├── create_roles_table.php
│   │   │   ├── create_feedback_table.php
│   │   │   └── create_wishlist_table.php
│   │   └── Seeds/
│   │       └── UserSeeder.php
│   │
│   ├── Filters/
│   │   ├── AuthFilter.php
│   │   └── RoleFilter.php
│   │
│   ├── Models/
│   │   ├── CategoryModel.php
│   │   ├── ProductModel.php
│   │   ├── ReviewModel.php
│   │   ├── UserModel.php
│   │   ├── EmailVerificationModel.php
│   │   ├── PasswordResetModel.php
│   │   ├── RoleModel.php
│   │   ├── FeedbackModel.php
│   │   └── WishlistModel.php
│   │
│   ├── Views/
│   │   ├── admin/
│   │   │   ├── categories.php
│   │   │   ├── create_category.php
│   │   │   ├── edit_category.php
│   │   │   ├── products.php
│   │   │   ├── create_product.php
│   │   │   ├── edit_product.php
│   │   │   ├── users.php
│   │   │   ├── edit_user.php
│   │   │   └── ...
│   │   │
│   │   ├── auth/
│   │   │   ├── login.php
│   │   │   ├── register.php
│   │   │   ├── request_reset.php
│   │   │   └── reset_password.php
│   │   │
│   │   ├── products/
│   │   │   ├── index.php
│   │   │   └── detail.php
│   │   │
│   │   ├── profile/
│   │   │   └── index.php
│   │   │
│   │   └── wishlist/
│   │       └── index.php
│   │
│   └── Language/
│       └── en/
│           └── messages.php
│
├── public/
│   ├── index.php
│   ├── .htaccess
│   ├── css/
│   ├── js/
│   └── uploads/
│
├── tests/
│   ├── _support/
│   └── Feature/
│
├── writable/
│   ├── cache/
│   ├── logs/
│   └── sessions/
│
├── vendor/
│
├── .env
├── composer.json
├── composer.lock
└── spark

Description of Each Component

  • app/: Contains the main application code.
    • Config/: Configuration files for the application, including routes and authentication settings.
    • Controllers/: Contains controller classes that manage the application’s logic and handle user requests.
      • Admin.php: Controller for admin functionalities.
      • AdminCategory.php: Controller for managing product categories.
      • AdminUser .php: Controller for managing users.
      • Auth.php: Controller for authentication processes.
      • Product.php: Controller for product-related actions.
      • Profile.php: Controller for user profile management.
      • Wishlist.php: Controller for managing user wishlists.
    • Database/: Contains database-related files.
      • Migrations/: Migration files for creating and modifying database tables.
        • create_users_table.php: Migration for the users table.
        • create_categories_table.php: Migration for the categories table.
        • create_products_table.php: Migration for the products table.
        • create_reviews_table.php: Migration for the reviews table.
        • create_email_verifications_table.php: Migration for email verification records.
        • create_password_resets_table.php: Migration for password reset records.
        • create_roles_table.php: Migration for user roles.
        • create_feedback_table.php: Migration for user feedback.
        • create_wishlist_table.php: Migration for user wishlists.
      • Seeds/: Contains seed files for populating the database with initial data.
        • User Seeder.php: Seeder for creating initial user records.
    • Filters/: Contains filter classes for request handling.
      • AuthFilter.php: Filter for checking user authentication.
      • RoleFilter.php: Filter for checking user roles and permissions.
    • Models/: Contains model classes that interact with the database.
      • CategoryModel.php: Model for category data.
      • ProductModel.php: Model for product data.
      • ReviewModel.php: Model for product reviews.
      • User Model.php: Model for user data.
      • EmailVerificationModel.php: Model for email verification records.
      • PasswordResetModel.php: Model for password reset records.
      • RoleModel.php: Model for user roles.
      • FeedbackModel.php: Model for user feedback.
      • WishlistModel.php: Model for user wishlists.
    • Views/: Contains view files for rendering the user interface.
      • admin/: Views for admin functionalities.
        • categories.php: View for displaying categories.
        • create_category.php: View for creating a new category.
        • edit_category.php: View for editing a category.
        • products.php: View for displaying products.
        • create_product.php: View for creating a new product.
        • edit_product.php: View for editing a product.
        • users.php: View for displaying users.
        • edit_user.php: View for editing a user.
      • auth/: Views for authentication processes.
        • login.php: View for user login.
        • register.php: View for user registration.
        • request_reset.php: View for requesting a password reset.
        • reset_password.php: View for resetting the password.
      • products/: Views for product display.
        • index.php: View for listing products.
        • detail.php: View for product details.
      • profile/: Views for user profile management.
        • index.php: View for displaying user profile.
      • wishlist/: Views for managing user wishlists.
        • index.php: View for displaying the wishlist.
    • Language/: Contains language files for localization.
      • en/: English language files.
        • messages.php: Language strings for the application.
  • public/: The public-facing directory accessible via the web server.
    • index.php: The main entry point for the application.
    • .htaccess: Configuration file for URL rewriting and server settings.
    • css/: Directory for CSS files.
    • js/: Directory for JavaScript files.
    • uploads/: Directory for uploaded files (e.g., product images).
  • tests/: Contains test files for the application.
    • _support/: Support files for tests.
    • Feature/: Feature test files.
  • writable/: Directory for writable files.
    • cache/: Directory for cache files.
    • logs/: Directory for log files.
    • sessions/: Directory for session files.
  • vendor/: Contains third-party libraries installed via Composer.
  • .env: Environment configuration file for setting environment variables.
  • composer.json: Composer configuration file that lists dependencies.
  • composer.lock: Lock file for Composer dependencies.
  • spark: Command-line tool for CodeIgniter 4.

More from our blog

See all posts

Leave a Comment