-
Notifications
You must be signed in to change notification settings - Fork 123
PHP IDE & Debugging for Laravel
The best applications are coded properly. This sounds like an obvious statement, but here 'properly' means that the code not only does its job well, but is also easy to add to, maintain and debug.
As PHP developers, we need to define and adhere to a coding style not because one is better than another but because we need a standard by which to collaborate.
Well this is the question which comes in our mind every time we write code. We just want to write a code that performs the required action. But to answer that question I'd like you to answer following questions-- Can you actually read the code? Is it spaced out clearly?
- Do you separate blocks of code into 'paragraphs' so that different sections are easily defined?
- Are you using indentation to show where control structures (if, else, while and other loops) begin and end, and where the code within them is?
- Are your variable naming conventions consistent throughout the code and do they briefly describe that data that they'll contain?
- Are functions named in accordance with what they do?
- If you come back to the code in a few weeks or months, will you be able to work out what's happening without needing to look at every line?
- How are you commenting the work?
- Can a new member in your team understand your code without scratching his head?
e.g
class Calculator
{
public function addXandY()
{
//method for adding two variables.
}
}
- Variables - all small case with underscore separator.
- eg variable_name or name
- Constants-Class constants MUST be declared in all uppercase with underscore separators. CONSTANT_NAME
- Functions- use camel case. First word should start with small letter after that all words should start with capital letter.
- e.g- function , functionName, functionNameFunction
- Classes- Class name should start with capital letter. All words in class should start with capital letter.
- e.g- ClassName, ClassNameClass
e.g
class ClassName
{
function functionName()
{
//function body
}
//body
}
e.g
if (a>b) {
//do someting
} else {
//do something
}
e.g
function functionName(arguments) if (condition) {Use proper indentation in your code, it increases readability of your code. Each line must have one statement only. And line must not be longer than soft limit (120 characters) if line exceeds this limit it is better to break it into two or more lines. All php developers are advised to follow coding standards. It will be annoying in starting but once you start writing clean code, your code will be more efficient, readable/understandable and easy to modify for changes in future.
Spend 10 minutes everyday to read these standards. Learn them and next time you write your code follow these standards.
There are various tools available which inspect your code against defined coding standards in php. Use these tools to check your code and fix coding standards in your code.
IDE likes Sublime and NetBeans have plugins which checks your code against coding standard and indicate errors in your code at the time of development. Use these IDEs and integrate these plugins so that you can write code that follows php coding standards.
Did you find it helpful? If not email us on [email protected]
- Server Requirement
- Installation with Apache 2.4
- Installation with cPanel
- Cron Job or any Job scheduler
Products
Users
Orders
Invoice
Pages
Settings
- Overview
- Check the Domain
- Download
- Latest Version
- Verify Product
- Renewal URL
-
Cloud APIs and Integration
- Tenant Creation API
- Change Domain API
- View Tenant
- Get Tenants
- Delete Tenant
- Delete Cloud Instance for Client
- Enable Cloud
- Domain Cloud Autofill
- Order Domain Cloud Autofill
- Upgrade Cost Calculator API Documentation
- Agent Alteration API Documentation
- Upgrade/Downgrade Cloud Service API Documentation
- Currency Formatting API Documentation
- Currency Format Processing API Documentation
- Payment Calculation API Documentation
- Update User Session API Documentation