Skip to content

Overview

Introduction

This page serves as a reference for the code standards used on OK Tamam projects and software. It provides general rules and guidelines that must be followed throughout all software life cycle processes, starting from how to name variables and classes to bug reporting and issue tracking.

While software best practices and guidelines can change from time to time, any changes to this document must be agreed upon by the tech team and the product managers. In addition to the basic guidelines provided, the following guidelines can also be considered

Naming Conventions

PHP and Laravel

  • Class names must be in PascalCase (Capitalized).
  • Method names must be in camelCase.
  • Variable names must be in camelCase.
  • Constants must be in uppercase.
  • Namespaces must be in PascalCase (Capitalized) with each part separated by a backslash (\\).
  • When using namespaces, the file path should match the namespace hierarchy.

Folder Structure

  • Use meaningful folder names that represent the function or purpose of the files they contain.
  • Use subfolders to further categorize related files.
  • Use a consistent folder structure across all projects.

Coding Standards

Third-Party Libraries

  • Use composer to manage third-party libraries.
  • Only use libraries that are actively maintained and have a large user base.

Design Patterns and Coding Practices

  • Use design patterns where appropriate.
  • Follow SOLID principles.
  • Write clean, modular, and reusable code.

Code Reviews

  • All code must be reviewed by at least one other developer before being merged into the main branch.
  • Use a code review checklist to ensure consistency and quality.

Testing Methodology

  • Use automated testing for all code.
  • Use PHPUnit,Pest,CypressJs for automated testing.

Version Control and Branching Strategy

  • Use Git for version control.
  • Use a branching strategy that fits the needs of the project.
  • Use descriptive commit messages.
  • Use pull requests for code reviews.

Documentation

  • Document all code using PHPDoc.
  • Use Markdown for README files and other documentation.
  • Write clear and concise documentation.

Bug Reporting and Issue Tracking

  • Use a bug tracking system to report and track bugs.
  • Provide clear steps to reproduce bugs.
  • Use descriptive bug titles and descriptions.

Security Guidelines

  • Follow OWASP guidelines for web application security.
  • Use Laravel's built-in security features.
  • Use encryption where appropriate.

Performance Optimization

  • Optimize database queries.
  • Use caching where appropriate.
  • Optimize code for speed and memory usage.

Accessibility Standards

  • Follow WCAG guidelines for web accessibility.
  • Use semantic HTML.
  • Use ARIA attributes where appropriate.

Internationalization and Localization

  • Use Laravel's built-in localization features.
  • Use UTF-8 encoding.
  • Use language and locale codes where appropriate.

By following these guidelines, we can ensure that our PHP and Laravel code is high-quality, maintainable, and meets the needs of our users.