Skip to content

freakabhi123/restful-bookmarks-phpslim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTful Bookmarks PHP Slim

TODO:

  • review and update FrontEnd

Sample application to bookmark links, where interface build with Angular.js + Twitter Bootstrap and server powered by PHP with Slim Framework, serving JSON by REST URLs.

Install Guide

Clone

$ git clone https://github.com/erkobridee/restful-bookmarks-phpslim.git
$ cd restful-bookmarks-phpslim/

Create Mysql Database

$ mysql -u DBUSERNAME -p MYSQLPASSWORD -e 'CREATE DATABASE bookmarks;'
$ mysql -u DBUSERNAME -p MYSQLPASSWORD bookmarks < bookmarks.sql

Mysql connections

edit user DBUSERNAME and MYSQLPASSWORD in api/dao/BookmarkDAO.php

...
  private function getDBConn()
  {
    $dbhost="127.0.0.1";
    $dbuser="DBUSERNAME";
    $dbpass="MYSQLPASSWORD";
    $dbname="bookmarks";
    $dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    return $dbh;
  }
...

XAMPP

  • Put project structure inside XAMPP /htdocs directory

Nginx example configuration

server {
  listen 127.0.0.1:80;
  access_log /var/www/restful-bookmarks-phpslim/log/access.log;
  error_log /var/www/restful-bookmarks-phpslim/log/error.log warn;

  server_name restful-bookmarks-phpslim;
  root   /var/www/restful-bookmarks-phpslim/public/;

  index  index.php index.html index.htm;
  try_files $uri $uri/ /index.php?$request_uri;

  location /rest/ {
    try_files /rest/$uri $uri/ /rest/index.php?$request_uri;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_split_path_info ^/rest/(.+\.php)(/.+)$;
    fastcgi_intercept_errors on;
    fastcgi_index  index.php;
    include fastcgi_params;
  }
}

Development with Sublime Text

  1. On Sublime Text, in menu: File > Open... select project directory location in you computer

  2. And happy coding :)

License

MIT : http://erkobridee.mit-license.org

Project build with

Helpful posts

Project REST URLs

HTTP Verbs

Project Structure

restful-bookmarks-phpslim/
  rest/
    dao/
      BookmarkDAO.php
    Slim/
      # Slim Framework files
    .htacess    # URLs map for Apache (XAMPP)
    index.php   # slim routes config
  app/
    # application files
  shared/
    # shared files with any future project
  vendor/
    # libs
  index.html
  require.config.js # require.js app config file

About

Bookmarks PHP webapp example using RESTful with Slim Framework

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 85.0%
  • JavaScript 6.7%
  • HTML 5.5%
  • CSS 2.6%
  • ApacheConf 0.2%