/PHPWorkshopAPI

Primary LanguagePHPMIT LicenseMIT

PHP Workshop - API

This package has been created to demonstrate how to build a simple API with PHP.

System requirements

  • PHP 5.6+ (with PDO)
  • MySQL 5.0+

Coding Standards and Conventions

  • Add a blank line before return statements, unless the return is alone inside a statement-group
  • Always use identical comparison unless you need type juggling
  • Use Yoda conditions when checking a variable against an expression to avoid an accidental assignment
  • Add a comma after each array item in a multi-line array, even after the last one
  • Use braces to indicate control structure body regardless of the number of statements it contains
  • Define one class per file
  • Declare class properties before methods
  • Declare public methods first
  • Naming Conventions
    • Classes: ClassName
    • Interfaces: INameOfInterface
    • Variables: $variableName
    • Methods: methodName()
    • Static methods: StaticMethodName()
    • Parameters: parameter_key