Setup

Installation

Composer is required.

StackSync is available as a composer package, you can install it by running the command below in your terminal while defining the targeted folder:

            composer create-project khomsiadam/stacksync project-name
            
        

Alternatively, you can download or clone the repository, then open the project and run the following command in your terminal:

            composer install
            
        

This installs the dependencies for php-jwt and phpdotenv which are the only required packages.

Configuration

After creating your database, in your root directory, you will find a .env.example file. Copy and rename to .env and start filling in your database informations.

            
# Database Credentials: *fill with your proper database information
DB_HOST=
DB_NAME=
DB_USER=
DB_PASS=

# Data Source Name: *do not modify! $_ENV['DSN'] is used as first argument for your PDO connection
DSN=mysql:host=${DB_HOST};dbname=${DB_NAME}

# Errors and responses status for error handling for the API:
ERRORS=ON
RESPONSES=ON

# Database User Table:
USER_TABLE=user

# Database User Columns (add any needed variable for every column added in user table):
USER_ID=user_id
USER_EMAIL=email
USER_PASSWORD=password

# Database Audience Table: *The recipient table for account for 'aud' in JWT token payload
AUDIENCE_TABLE=
# Database Other Tables: *Other tables you may need, as argument for your CRUD operations in controller methods
EXAMPLE_TABLE=

# API Token Authentication Secret Keys: *fill with your own key or add new keys as needed
SECRET_KEY=
            
            
        

Welcome

Opening your terminal, navigating to your project folder:

            cd project-name
            
        

Then running this command:

            composer serve:local
            
        

Will run PHP's built in development server on your local machine and browsing to `http://localhost:8080` will show a welcome homepage.

StackSync mini-framework homepage