What’s a PHP composer? How to use PHP composer in your PHP Application? What are the benefits of using composer in your application?
PHP Composer is a dependency manager. It manages the dependency of PHP packages in your application. Using composer you can pull the required library and dependencies and manage them in one place. The concept of a composer is similar to npm in node.js and gem in Ruby.
Let’s first understand what is a dependency.
What are PHP Magic Methods?
PHP Magic methods are a specialized method that is executed in response to a specific event. Each magic methods start with two underscores(__) and it is called automatically when a certain condition is met. It triggers custom behaviors defined by a programmer inside the class. Some of the magic methods are __construct(), __destruct(), __toString(), __get(), __set(), __call() etc.
In this tutorial, we are going to explore these magic methods.
PHP Magic Methods
PHP 7 Features Explained with Code Examples.
PHP 7 is the newest version of PHP released last year. PHP community has introduced a lot of new features in their latest version. In this tutorial, we are going to learn about new features added in PHP 7.
What is an interface in PHP? An interface is an important concept in an object oriented programming.
In this tutorial, we’ll discuss following points.
1. What is an interface?
2. How to create an interface in PHP.
3. What’s the importance of using an interface in our PHP application?
Interface in PHP
What is an Interface in PHP?
An Interface defines a contract for what a class can do, without saying anything about how the class can do it. Through interfaces, we define what a class can do, the classes that implement interface define how it can do it.
To understand the concept of an interface let’s take an example of a caching system. There are different types of caching available such as File system, Memcache, Redis etc. First, we need to define what a cache can do (I mean different operations), how we do it? we can do it through an interface. A class (Such as Memcache, Redis etc) which implements cache interface will define how they will do it.
NOTE – An interface will not add any additional functionality in your code but it outlines a standard format to which your classes need to use.
How to create multiple database connections in Lumen.
Last week I was working on a project in which I need multiple Database connections. I need one separate database connection for reporting (Only for a read operation) and another for the rest of the work (Read & write both).
How to debug SQL queries in Laravel & Lumen. During development of an application, there may be times when we need to write large and complex queries. Laravel provides an awesome query builder and ORM (Eloquent) to do this task effortlessly. But sometimes we would like to see the actual SQL being generated.
Write a script to reverse a string in PHP without using strrev() method. In PHP, we can reverse a string easily using strrev() method. But think how will you reverse a string without using an inbuilt strrev() method.
Late Static Binding is a very important concept in PHP. In this tutorial, We’ll learn what is late static binding and how to use this concept.
In PHP, late static binding is used to reference the called class in the context of static inheritance.
How to deny access to files, folders through htaccess file. In this tutorial, We are going to learn .htaccess directives through which we can deny direct access to files and folders.
How to Deny Access to Files, Folders through htaccess
What is .htaccess File?
.htaccess is a configuration file used by a web server (Apache). The full form of htaccess is Hypertext Access. Htaccess files are used to override server global configuration for the directory level in which you place this file.
I got following fatal error in php can’t use method return value in write context. When this fatal error comes i didn’t understand what’s wrong with my code, as everything looks fine in my code editor. So i started debugging what’s the root cause for this error.