Skip to content

Instantly share code, notes, and snippets.

View shahroznawaz's full-sized avatar

Shahroze Nawaz shahroznawaz

View GitHub Profile
@shahroznawaz
shahroznawaz / message.php
Created January 23, 2018 10:33
Check and Return The Received Message
<?php
require __DIR__ . '/vendor/autoload.php';
// Change the following with your app details:
// Create your own pusher account @ https://app.pusher.com
@shahroznawaz
shahroznawaz / Index.html
Created January 23, 2018 10:30
Send the User message to server.
<!DOCTYPE html>
<head>
<title>Pusher Test</title>
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" type="text/javascript" ></script>
<script src="https://js.pusher.com/4.1/pusher.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js" type="text/javascript" ></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.min.js" type="text/javascript" ></script>
@shahroznawaz
shahroznawaz / UserController.php
Created January 22, 2018 08:53
User Controller
class UserController extends Controller
{
public function indexAction()
{
// All 3 return the "default" entity manager
@shahroznawaz
shahroznawaz / Symfonydb.md
Last active January 22, 2018 08:38
Use Multiple Databases In Symfony Projects On Cloudways

In many of my previous articles, I have covered Entity Managers and Doctrine in Symfony. The tutorials have covered the process of generating and configuring entities in Symfony. Now a common scenario in real world Symfony projects is the requirement of working with multiple databases. In many cases, the project requires access to two or more databases simultaneously for Doctrine related actions. I will cover this topic in this tutorial.

For the purpose of this tutorial, I am assuming that you have already installed Symfony on Cloudways and that it’s running properly in the browser.

##The Traditional DB Config While installing Symfony, the Symfony Installer asks questions about the database credentials:

The following credentials are available in the parameters.yml file:

<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions - freek@spatie.be</title>
</head>
<body>
<outline text="PHP" title="PHP">
<outline htmlUrl="http://mattallan.org" title="mattallan.org" xmlUrl="http://mattallan.org/feed.xml" type="rss" text="mattallan.org"/>
<outline title="asked.io" xmlUrl="https://asked.io/rss" type="rss" text="asked.io"/>
<outline htmlUrl="https://ocramius.github.io/" title="ocramius.github.io" xmlUrl="https://ocramius.github.io/atom.xml" type="rss" text="ocramius.github.io"/>
@shahroznawaz
shahroznawaz / User.php
Created March 28, 2017 10:40
User entity file
<?php
// src/AppBundle/Entity/User.php
namespace AppBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="fos_user")