Skip to main content

Posts

JSON Tutorials : Getting Started

JSON is widely accepted text formatted structured data. JSON stands for " JavaScript Object Notation ". In general JSON can represent 1. Object of database record. 2. Object to represent a list of HTML elements. 3. Result of search query. 4. Response of an Ajax call. Here you can see JSON is used in many different areas and for many different scenarios. This means it has simple data structure. most of programming languages adopt it and it can flow easily from one connection to another. You can find JSON office definition here JSON Official Site . JSON is represented by two structural types, which includes two primitive types. Structural types Array : A sequential list of primitive data types between square brackets [ ] Object : Collection of key, value pair stored inside curly braces { }, where value would be primitive data type Primitive types : There are two primitive types key and value. " key " should be string and " value (data type)

Doctrine 2 Tutorial: Installation and Configuration

In this tutorial, we will look at how to install Doctrine2 in your PHP project. This post will make use of Doctrine2's Composer tool. Installation First, create a directory for your project. mkdir zainabed cd zainabed Now, create a composer.json file. vi composer.json Then, add the following repository information to it . { "require" : { "doctrine/orm" : "*" } } You are now ready to use Composer to install Doctrine, but first you must install Composer on your machine. curl -sS https://getcomposer.org/installer | php To install Doctrine2, run the following command. php composer.phar install Note: Composer generates a "autoload.php" file to help in the autoloading of all PHP classes in the Doctrine2 ORM project. Configuration First, create a configuration file, configuration.php  for Doctrine2 and include  autoload.php  inside it. <?php // configuration.php // In

Twig Tutorials: Install and Configure

In this tutorial, we'll look at how to install Twig within your PHP project and thereafter configure it so that we can create and use a Twig template inside our PHP web application. Later on, we'll see a simple Twig template example that displays a "Welcome to Twig template" message. Let's take it one step at a time. Install The Twig template can be installed using Composer, Git, or PEAR. In this tutorial, we will use Composer to install Twig. To do so, we'll need to make a "composer.json" file. { "require" : { "twig/twig" : "1.*" } } From the console, run the following command . $ php composer.phar install This command will install Twig library. Configuration To use the Twig template, we should first configure it. To achieve this, we will write an index.php file which will configure the Twig autoloader and generate the Twig environment. We will render the Twig temp

How to create an SSH key for GitHub and Bitbucket

This post will show you how to generate SSH private and public keys step by step, as well as how to add public keys to your GitHub and Bitbucket accounts. But first, why do we require this SSH public key? If you want to do any work on a secure GIT repository, such as cloning or pushing your latest changes, you will need to provide your credentials to help GIT authenticate you and approve those operations, whether you are working in a team or as an individual. However, each time you operate, you are prompted to enter your username and password. It appears simple at first, but it quickly becomes a source of frustration. To overcome the above problem, we can use the SSH protocol. SSH connections allow us to authenticate using public and private keys that we generate only once. after that, we don't need to authenticate because SSH will do so on our behalf. But how does it work? SSH authenticates you using an identity, and this identity is made up of a combination of private an

Symfony Tutorials: Event Dispatcher

Symfony EventDispatcher is object which interacts with different set of objects when certain event happens. To illustrate Event Dispatcher definition let’s consider the online shopping website example. suppose  you want to purchase a mobile f rom online shopping website , but unfortunately that mobile is out of stock. Then you subscribe into online shopping website for this mobile availability. When mobile comes in stock, online shopping website notifies you about mobile phone’s availability via email. In above scenario you are the Event Listener / Event Subscriber mobile availability is Event online shopping website is Event Dispatcher . Symfony EventDispatcher works in same manner.for example, whenever there is HTTP request, Kernel creates a request object and it dispatches an event kernel.request . Whoever subscribes to kernel.request event gets notified. So here you might be having few questions in my mind. What is Event?

Drupal 8 Tutorials : Custom Module

Custom Module development in Drupal 8 is very simple. It may looks very difficult for developer who has Drupal 7 experience or nothing at all. This tutorial will show easy steps and helps you to create custom module within few minutes. Note: Content or example of this tutorial may change according to Drupal 8 version and its release. This tutorial is divided into three small sections. In first section of this tutorial we will see what directory structure we need to create for a custom module. In second section we will see what type files we need to create. And in last section we will see what code we need to write in those files and configure them in Drupal 8. 1 Directory Structure All custom module in Drupal 8 reside under “module” directory of Drupal 8 project. To create a custom module we will create a new directory named “document” under custom folder. Following is directory structure. 2 Configuration files Secon

JAX-RS Tutorilas: Hello World Example

Following is simple  JAX-RS  tutorial, which sends “Hello World” text as response string using JAX-RS API and Jersey implementation. Technologies and Tools used in this article: 1.    JDK  2.     Eclipse  3.    Tomcat 4.    Maven  5.     Jersey 1.8 Create Maven Web Project Create a Maven web project and name it "helloworld" . File -> New -> Other -> Maven Project -> Next Select  maven-archetype-webapp Select  Next Type  Group Id,   Artifact Id  and  Package  name And select  Finish Add Project Dependencies Add Jersey repository using Maven. Use following URL to get appropriate repository. http://mvnrepository.com/artifact/com.sun.jersey/jersey-server Now update pom.xml file. File : pom.xml <project ...  > ...         ... <dependencies>                 ...                 ... <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-server&

Subscribe for latest tutorial updates

* indicates required