Skip to content

A Letterpress clone in PHP and Javascript

Notifications You must be signed in to change notification settings

meetrajesh/letterpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Letterpress

This is a web-based clone of the popular iOS word-game Letterpress using purely PHP and Javascript.

Dev Setup Instructions

Minimum Requirements

  • Running Apache Server
  • PHP 5.3.6+. May work on PHP 5.2.x for now, but no guarantees it will continue to work going forward
  • MySQL Server + Client
  • git client v1.7+

Setup Instructions

  1. Fork and Clone GitHub repo

  2. Setup Apache VHost

    • Setup a vhost in your apache config file as shown below. On Mac, the config file lives inside /etc/apache2/httpd.conf. On Linux, it's typically at /etc/httpd/conf/httpd.conf. Depends on your distro.

      ### for letterpress ###
      <VirtualHost *:80>
        ServerName localhost
        DocumentRoot "[webroot]>"
        <Directory "[webroot]">
          Options +FollowSymlinks
          Order allow,deny
          Allow from all
          AllowOverride All
        </Directory>
      </VirtualHost>
      
    • Replace [webroot] with the full path of the parent directory that contains your letterpress git repo that you checked out in the previous step. So if you checked out your repo at /home/john/phpwebroot/letterpress, your [webroot] will be /home/john/phpwebroot

    • The AllowOverride All line is important. Don't forget it. It allows you to setup URL rewriting rules via an Apache-specific .htaccess config file which you can view here: https://github.com/meetrajesh/letterpress/blob/master/.htaccess

    • Restart Apache for the changes to take effect: sudo /etc/init.d/httpd restart on Linux, and sudo /usr/sbin/apachectl restart on Mac OS X.

  3. Setup MySQL DB

    • Import the MySQL database schema locally. I've assumed you have a blank user with a blank password that has admin (or at least database creation) privileges:

      $ mysqladmin create letterpress
      $ mysql letterpress < /home/john/phpwebroot/letterpress/schema.sql
      
  4. Override Config

    • Create a file called init.local.php in your letterpress root directory and copy+paste this in there:

      <?php
      
      define('BASE_URL', 'http://localhost');
      define('IS_DEV', true);
      define('CSRF_SECRET', '<put some random string here thats about 40 chars long>');
      
      // database credentials
      define('DBHOST', 'localhost');
      define('DBUSER', '');
      define('DBPASS', '');
      define('DBNAME', 'letterpress');
      
    • Replace your local database credentials if different from the constants above.

    • Replace the CSRF secret with a randomly generated string. Use this PHP code if you want to generate a 32-character random string:

      $secret = '';
      foreach (range(1, 32) as $i) {
          $secret .= chr(rand(33, 126));
      }
      echo $secret;
      
  5. Navigate to http://localhost/letterpress on your browser. If everything was set up properly, the game should load successfully. If not, ping me at rajesh@meetrajesh.com and we'll work it out together.

Pull Request

  1. Once you're done committing and pushing all your changes to your fork, submit a pull request using github from your master branch to my master branch.

  2. Please try to adhere to the coding style already found in the project before you submit your pull request. Most notably:

    • Tabs instead of spaces for indentation (except in README.md where we use spaces)
    • Opening brace on same line. Closing brace on new line.
    • Braces mandatory even for 1-line cases
    • Exactly 1-space before opening brace
    • Exactly 1-space after these keywords: if, elseif, for, foreach, while, and switch
    • Exactly 1-space after commas in argument lists

About

A Letterpress clone in PHP and Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published