2017 © Pedro Peláez
 

project someline-starter

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

image

someline/someline-starter

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  • Sunday, July 29, 2018
  • by libern
  • Repository
  • 54 Watchers
  • 792 Stars
  • 1,764 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 158 Forks
  • 19 Open issues
  • 93 Versions
  • 3 % Grown

The README.md

Someline Starter PHP Framework

Tested and used in production by Someline Inc., (*1)

Latest Version on Packagist ![Software License][ico-license], (*2)

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation., (*3)

It is built on top of popular Laravel 5.8 framework, Vue.js 2.6, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer., (*4)

Someline Starter is born for 3 reasons:

  1. Quick web application starter without the need to build from scratch using Laravel., (*5)

  2. Isolated front-end and back-end layer using Restful API., (*6)

  3. Introducing modern design pattern, which have a better foundation when starting, for PHP projects., (*7)

See In Action

Someline Starter Demo

Frontend with Vue.js and displaying data via Restful API, (*8)

Email: libern@someline.com, (*9)

Password: Abc12345, (*10)

See In Video

Watch the video tutorial from below., (*11)

YouTube: https://youtu.be/6_lxJNX0Qe0, (*12)

Framework Overview

Someline Starter is suitable for Restful API oriented projects., (*13)

The Restful APIs as a backend layer which provide simple unified interfaces for frontend: Web and Mobile apps., (*14)

It utilized Laravel Passport to authenticate protected resources., (*15)

It also provides Unit Tests for API testing and framework testing., (*16)

It is shipped with Angulr Theme and features in every part that you can easily reference., (*17)

It is fully utilised Repository Design pattern., (*18)

Out-of-box Components

Framework - Laravel 5.8 laravel/framework - Laravel IDE Helper barryvdh/laravel-ide-helper - Clockwork itsgoingd/clockwork - Laravel 5 log viewer rap2hpoutre/laravel-log-viewer, (*19)

Foundation - Redis predis/predis - GuzzleHTTP guzzlehttp/guzzle - HTTP Status lukasoppermann/http-status, (*20)

Core - Restful API dingo/api - L5 Repository prettus/l5-repository - Fractal thephpleague/fractal - Laravel Validation prettus/laravel-validation - Intervention Image intervention/image - Intervention Image Cache intervention/imagecache - Rest API Client someline/rest-api-client - Someline Image Service someline/someline-image, (*21)

Authentication - Laravel Passport laravel/passport, (*22)

Theme - Angulr theme with Bootstrap and jQuery support. For Demo: Angular version and HTML version., (*23)

Please buy a license if you use this in your project., (*24)

Frontend - Vue.js Reactive Components for Modern Web Interfaces, (*25)

Get Started

Make sure you have already installed PHP 7.1 and composer., (*26)

You can get started either option A or B:, (*27)

A. Get started via composer

Under working folder, run the command:, (*28)

composer create-project --prefer-dist someline/someline-starter someline-starter

A.1. Add to a git repository (When Needed)

Change https://github.com/username/repository-name.git to your own git repository address., (*29)

cd someline-starter

git init
git add .
git commit -m 'Initial commit'

git remote add origin https://github.com/username/repository-name.git
git push -u origin master

B. Get started via cloning repository

Clone this project to your working folder and open the directory:, (*30)

git clone https://github.com/someline/someline-starter

B.1. Add to a git repository (When Needed)

Change https://github.com/username/repository-name.git to your own git repository address., (*31)

cd someline-starter
rm -rf .git

git init
git add .
git commit -m 'Initial commit'

git remote add origin https://github.com/username/repository-name.git
git push -u origin master

Installation

Development Requirements

  • PHP: >=7.1.8
  • MySQL: >=5.7
  • SQLite extension
  • Laravel 5: https://laravel.com/docs/5.8/installation
  • Yarn: https://yarnpkg.com/
  • NodeJS: https://nodejs.org/
  • Bower: https://bower.io/

Install Essentials

Open someline-starter folder (Optional, run only when you are not inside the project root folder), (*32)

cd someline-starter

All these commands should be executed under the root of someline-starter project, (*33)

Install composer dependencies, (*34)

composer install

Install npm dependencies using Yarn dependency management (suggested), (*35)

Note: This command should be outside homestead environment. Also, you can still use npm install if you want., (*36)

yarn install

Install bower dependencies, (*37)

bower install

Set-up Laravel, after these commands, please change .env file for your own environment settings, (*38)

sudo cp .env.example .env
sudo chmod -R 777 storage bootstrap/cache
php artisan key:generate

Database & Seeding

You need to create a Database e.g. someline_starter with Encoding utf8mb4 and Collation utf8mb4_unicode_ci., (*39)

MySQL Query:, (*40)

CREATE DATABASE `someline_starter` DEFAULT CHARACTER SET = `utf8mb4` DEFAULT COLLATE = `utf8mb4_unicode_ci`;

Change database config in .env file to the match the database that your just created., (*41)

After having database configuration setup, you can now do migrations and seeding., (*42)

php artisan migrate

php artisan db:seed

Install Laravel Passport with encryption keys to generate secure access tokens., (*43)

php artisan passport:install

When deploy in server:, (*44)

sudo chown www-data:www-data storage/oauth-*.key
sudo chmod 600 storage/oauth-*.key

Ready to go

Until this point, you should be able to visit the home page., (*45)

For example, if you have set the domain: http://someline-starter.sl/., (*46)

Just visit: http://someline-starter.sl/, (*47)

It should prompt you for login, use:, (*48)

libern@someline.com
Abc12345

You are free to change the seeding account information from the file: database/seeds/UsersTableSeeder.php, (*49)

You are done. Yeah!, (*50)

Explore and start to build on top of it., (*51)

Development Process and Flow

Essential Knowledge

You will need to know, read and understand fowllowing before you can start build on top of these., (*52)

We recommend use PHPStorm IDE to build and develop your projects., (*53)

Namespace

The default namespace for app/ folder is Someline., (*54)

It is NOT recommended to change the namespace, if you are not familiar with namespace of Someline Starter as the Someline namespace is used heavily within whole project., (*55)

However, you can still change it if you know how what you are doing, because some namespaces required manually changing., (*56)

To change namespace to your preference:, (*57)

php artisan app:namespace YourApp

BaseClass

In order to utilize all features provided by Someline Starter, you should extended the Class from BaseClass (if there has one), e.g. BasePresenter, BaseController, etc., (*58)

Models

All models are located under app/Models/ folder., (*59)

User Model under folder app/Models/Foundation/ is created by default with primary key user_id, you should not change this class heavily because it is used almost everywhere within whole project. You can use global function auth_user() to access currently logged in user., (*60)

Every model should extend Someline/Models/BaseModel which has a observer Someline/Observers/BaseModelObserver that you can utilize all model events within the Model, e.g. onCreating, onCreated, onUpdating, onDeleting, etc., (*61)

When creating new model, you should do it using command to auto generate related Repository classes., (*62)

php artisan starter:entity Post

Web Http

All Web related files are located under app/Http/ folder., (*63)

Web Routes are defined in file routes/web.php, (*64)

Web Controllers are defined in folder app/Http/Controllers/, (*65)

Restful API

All API related files are located under app/Api/ folder., (*66)

API Routes are defined in file routes/api.php, (*67)

API Controllers are defined in folder app/Api/Controllers/, (*68)

When you create APIs, you need to test them before you can use it. You should test all APIs using Unit Tests provided or create new Unit Tests. Not recommended to test using Browser or Postman, etc., (*69)

Repository Pattern

All repository related files are located under app/ with specific types as parent folders., (*70)

Repositories: app/Repositories/, (*71)

Repositories Eloquent: app/Repositories/Eloquent/, (*72)

Repositories Interface: app/Repositories/Interfaces/, (*73)

Repositories Criteria: app/Repositories/Criteria/, (*74)

Presenters: app/Presenters/, (*75)

Transformers: app/Transformers/, (*76)

Validators: app/Validators/, (*77)

Resouces

Angulr Styles and Scripts: resources/assets/angulr/, (*78)

Angulr with Blade views: resources/views/angulr/, (*79)

Vuejs: resources/assets/js/, (*80)

Less styles: resources/assets/less/app.less, (*81)

Sass styles: resources/assets/sass/app.scss, (*82)

When made changes in scripts, styles, you will need to run the command., (*83)

In development, run:, (*84)

yarn run dev

In development and watching assets for changes, run:, (*85)

yarn run watch

In production, run:, (*86)

yarn run production

When you changed theme files, run:, (*87)

yarn run theme

API and Unit Tests

Note:, (*88)

You may need to change the local service configs under dev environment from config/rest-client.php to fit your local development configurations., (*89)

Also change the value of API_TEST_CLIENT_SECRET in .env file to the secret value of Password Grant Client record in oauth_clients table., (*90)

Unit Tests: tests/, (*91)

API Unit Tests: tests/Api/, (*92)

Debug and Clockwork

View all requests and request information from file storage/clockwork.sqlite, (*93)

OAuth Web Support

OAuth HTTP URL: http://someline-starter.sl/console/oauth, (*94)

Web Log Viewer

Log Viewer HTTP URL: http://someline-starter.sl/console/logs, (*95)

Database

We recommend to use migrations for database structure and seeding.

Directly changing from database or not follow migrations is strongly NOT recommended., (*96)

Flow of creating database migrations:
  1. Create a migration file (Auto generated when use php artisan starter:entity), under folder database/migrations/, (*97)

  2. Add essential columns to migration file (Auto generated when use php artisan starter:entity):, (*98)

You are recommended to use tablename_id format as primary incremental key, for example, for table posts, you need to use post_id, and when this become a foreign key, you should keep the same name in other table post_id., (*99)

$table->increments('post_id');

You are also recommended to use the user_id field in all tables, for example, use user_id as staff id instead of staff_id in company_staffs table. If there are no meaning for user_id in certain tables, you should still put user_id field in case for future usage. So, you need to use it smartly to fit your table scenarios accordingly. And, similarly, you may optionally want to add a related_user_id field to indicate certain record is related to a user depends on your own needs., (*100)

The following columns are always required by BaseModel:, (*101)

$table->unsignedInteger('user_id')->index();

$table->unsignedInteger('created_by')->nullable();
$table->timestamp('created_at')->nullable();
$table->ipAddress('created_ip')->nullable();
$table->unsignedInteger('updated_by')->nullable();
$table->timestamp('updated_at')->nullable();
$table->ipAddress('updated_ip')->nullable();

And remove timestamps():, (*102)

// $table->timestamps();

Finally, the table blue print should be looks like, e.g. in posts table:, (*103)

$table->increments('post_id');
$table->unsignedInteger('user_id')->index();

// Adding more table related fields here...

$table->unsignedInteger('created_by')->nullable();
$table->timestamp('created_at')->nullable();
$table->ipAddress('created_ip')->nullable();
$table->unsignedInteger('updated_by')->nullable();
$table->timestamp('updated_at')->nullable();
$table->ipAddress('updated_ip')->nullable();
  1. Add factory support, under file database/factories/ModelFactory.php, (*104)

  2. Create seeding support, under folder database/seeds/, (*105)

Refresh Database Migrations and Seeding

When you added or changed to migrations or seeds files, or you just simply want to refresh everything in database:, (*106)

php artisan migrate:refresh --seed

License

The Someline Starter framework is open-sourced software licensed under the MIT license., (*107)

The Versions

29/07 2018

dev-master

9999999-dev

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

29/07 2018

v0.7.9

0.7.9.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

29/07 2018

dev-5.6.17@dev

dev-5.6.17@dev

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

22/06 2018

v0.7.8

0.7.8.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

24/05 2018

0.7.7

0.7.7.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

10/05 2018

v0.7.6

0.7.6.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

23/04 2018

v0.7.5

0.7.5.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

22/04 2018

v0.7.4

0.7.4.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

21/04 2018

v0.7.3

0.7.3.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

21/04 2018

v0.7.2

0.7.2.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

21/04 2018

v0.7.1

0.7.1.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

20/02 2018

v0.6.6

0.6.6.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

20/02 2018

dev-5.5.1@dev

dev-5.5.1@dev

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

19/02 2018

v0.6.5

0.6.5.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

07/02 2018

v0.6.4

0.6.4.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

07/09 2017

v0.6.3

0.6.3.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

02/09 2017

v0.6.2

0.6.2.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

17/07 2017

dev-5.4.3@dev

dev-5.4.3@dev

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

28/05 2017

v0.5.3

0.5.3.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

23/03 2017

v0.5.2

0.5.2.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

11/03 2017

v0.5.1

0.5.1.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

11/03 2017

v0.5.0

0.5.0.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

02/03 2017

v0.4.9

0.4.9.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

21/02 2017

v0.4.8

0.4.8.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

20/02 2017

v0.4.7

0.4.7.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

20/02 2017

v0.4.6

0.4.6.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

13/02 2017

v0.4.5

0.4.5.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

13/02 2017

v0.4.4

0.4.4.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

10/02 2017

v0.4.3

0.4.3.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

10/02 2017

v0.4.2

0.4.2.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

07/02 2017

v0.4.1

0.4.1.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

07/02 2017

v0.4.0

0.4.0.0

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern design pattern foundation.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework someline-starter someline

25/08 2016

dev-development

dev-development

The Laravel Framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework

13/08 2016

v0.2.1

0.2.1.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs

13/08 2016

v0.2.0

0.2.0.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs

29/07 2016

v0.1.3

0.1.3.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs

22/07 2016

v0.1.2

0.1.2.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs

22/07 2016

v0.1.1

0.1.1.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs

22/07 2016

v0.1.0

0.1.0.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs

21/07 2016

v0.0.6

0.0.6.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs

20/07 2016

v0.0.5

0.0.5.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs

06/07 2016

v0.0.4

0.0.4.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs

02/07 2016

v0.0.3

0.0.3.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs

18/06 2016

v0.0.2

0.0.2.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs

14/06 2016

v0.0.1

0.0.1.0

Someline Starter is a framework for quick building Web Apps or APIs, with modern PHP design pattern foundation, which is built on top of popular Laravel 5 framework, Vue.js, Restful API, Repository Design, OAuth2, JWT, Unit Tests, isolated front-end and back-end layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel api framework oauth jwt restful vuejs