PYROCMS – CheatSheet

Pyro – Laravel Development Platform

Upgrading

Clear composer cache

Migration

Seeding

  • Create seed
  • Run seed
  • Seed Addon

Module/Addons

Addon

Images

Installing a private package with composer

Most of PHP framework now a day uses composer.json to install packages. In this article I am going to show you an overview on adding PHP packages from your private repository to a composer.json file.

1. Configure Composer

Add this line into your composer.json to point to your private repository.

2. Create an SSH key

Create an SSH Key on the machine on which you want to install the package.

If you are on a development machine, you probably want to add the SSH key to your GitHub or Bitbucket account. This gives you access to all private repositories on your account.

For your reference you can visit the link below:

3. Run composer

Lastly, you can run composer require or composer install to install the package.

That’s it! You can now start adding your packages from your private repositories.  Happy Coding!!

Apache Installation on Windows(Apache 2.4, PHP7)

For Web Developers, one of the requirements for testing web application is having a web server. Apache is one the popular Web Server used for most Web Server. The Apache HTTP server is an open-source Web server application developed by the Apache Software Foundation. The server software is freely distributed, and the open source license means users can edit the underlying code to tweak performance and contribute to the future development of the program.

In this article, I will show you steps on how to install Apache Server on Windows Machine.

How to install Apache 2.4 and PHP 7?

Let’s start:

To get started, download necessary files for this installation.

1. After you download Apache zip files extract the files into your root directory C:/Apache24.

Apache Installation on Windows

2 . Navigate to your Apache directory C:/Apache24/Conf and open file httpd.conf.

Apache Installation on Windows

3. Find and replace the following line below from httpd.conf file.

4. Register Apache Service using a command prompt. Change the CMD directory to C:\Apache24/bin

Apache Installation on Windows

Then, execute command httpd –k install . To install  Apache to your local machine.

Apache Installation on Windows

5. Verify Apache installation using services.msc. Open run command and type services.msc.

Apache Installation on Windows

Services window will open. Search for Apache2.4 service. If it looks like the image below then you have successfully installed Apache and it is already running.

Apache Installation on Windows

6. Create an index.html file inside folder C:\Apache24\htdocs.

Apache Installation on Windows

Run localhost:8080 from your browser to check if it is working.

Apache Installation on Windows

PHP Installation (7.0.13)

To complete Apache Server we also need to install PHP. In my case, I used PHP version 7.0.13. I assume you have already downloaded the files using the link from the beginning of this post.

Apache Installation on Windows

Let’s Start:

1.  Extract the PHP zip files to your root directory which is C://.

Apache Installation on Windows

2. Now open PHP folder and locate files naming Php.ini – development. Rename it to Php.ini

Apache Installation on Windows

3. Open Php.ini files and remove the semicolon to uncomment the lines of code shown below. This will load PHP extensions you need for your development server.

  • extension=msql.dll
  • extension=php_curl.dll
  • extension=php_ftp.dll
  • extension=php_mysqli.dll
  • extension=php_openssl.dll
  • extension=php_pdo_mysql.dll

4. To integrate Php to Apache open httpd.conf from you Apache folder(C:\Apache24\C:\Apache24\conf).Find and replace the lines shown below and make sure that the directory is pointing to your PHP folder(C:/Php).

5. Restart Apache using httpd –k restart.

Apache Installation on Windows

Check if PHP is working.

Open index.html from C:\Apache24\htdocs and modify code using the line below.

Open your browser and run localhost:8080 to see if it echoed the word hello world.

Apache Installation on Windows

And we are done. Hope this help!

Happy Coding!!

PHP Code for Encryption and Decryption

PHP Code for Encryption and Decryption – We will create one of encryption mechanism in this blog. Below are codes on how to implement triple des encryption.

Let’s Start:

First, Create a php file inside htdocs folder if you are using XAMP or WAMP navigate to C:\xampp\htdocs.

Copy code below:

Encryption:

 

Decryption:

 

To use and try this function

 

Code Summary:

 


Post you may like:

[pt_view id=”2384ae03it”]

Basic PHP Restful Web Services Implementation(Web API)

Restful Web Services

API in Programming Overview:

          Application program interface (API) is a set of Instructions, protocol, or implementation that is created to be accessible in client side application. It is also used for securely transmitting of data when it comes to the database application. It Controls data flow and limit client side application to have a full control of the main data. A good API can secure database from being vulnerable to hacking.

Basic API Concept Diagram sample:

 

Restful Web Services

API Concept is to transmit data from a Database and used it in a Client side application like Websites or windows application through our Web API.

Instead of using actual database connection from a database, we are going to use an Array of data to represent our database and process data in Web API, and pass data to our client application which I’m going to use JQuery in receiving data from the API.

 

Coding Diagram:

  • Database.php => Contain Array of Data to represent our Database
  • myWebAPI.php => Represent as Web API
  • Consume.php => Represent as our Client side application that consumes our API

I use www.000webhost.com for my hosting . Click Here for free web hosting

I uploaded myWebAPI.php in 000WebHost and consume it using xampp Localhost in my local Computer.

Database.php

Note:
$find => Parameter need to be pass to select data from array

 

Array return data
• 1 = > Asp.Net
• 2 => PHP
• 3=> C#

 

If $find value is equal to 1 the return should be Asp.Net

 

myWebAPI.php

Consume.php

Note:
Common problem encountered in JQuery is the Cross-origin Resource Sharing (CORS) that is block in most of the hosting sites. As a work around we used JQuery JSONP datatype.

 

Ajax URL:

  • jsonCallback => is the  callback we specify in myWebAPI.php ($_GET[‘jsonCallback’].'(‘.$ json_response.’)’;)
  • number => is the parameter  from myWebAPI.php (($_GET[‘number’])))