Download the PHP package milkmeowo/starter-framework without Composer
On this page you can find all versions of the php package milkmeowo/starter-framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download milkmeowo/starter-framework
More information about milkmeowo/starter-framework
Files in milkmeowo/starter-framework
Package starter-framework
Short Description The Laravel / Lumen Starter Framework.
License MIT
Informations about the package starter-framework
starter-framework
Overview
This package is suitable for Restful API oriented projects
The Restful APIs as a backend layer which provide simple unified interfaces for frontend: Web and Mobile apps.
It utilized Laravel Passport to authenticate protected resources.
It is fully utilised Repository Design pattern.
Features
- Dingo Api Support
- l5-Repository Support
- Laravel Passport Support
- ide-helper Support
- clockwork support
- Cors support
- All of the above are supported for laravel & lumen
Getting started
Installation via Composer
Register the ServiceProvider
Register the starter-framework service provider by adding it to the providers array.
Laravel
Lumen
Modify the bootstrap flow (bootstrap/app.php file)
Publish the configure
then copy config files into your project.you can finish this manually
or for Laravel you can use
and change config/auth.php
api guards driver to passport
Migrate and install Laravel Passport
Packages Documents
Dingo
improve
Exception Handle Register
add src/Framework/Dingo/Providers/ExceptionHandlerServiceProvider
to register the common Exception handle
- Illuminate\Auth\Access\AuthorizationException
- Illuminate\Auth\AuthenticationException
- Illuminate\Database\Eloquent\ModelNotFoundException
- Illuminate\Http\Exception\HttpResponseException
- League\OAuth2\Server\Exception\OAuthServerException
- Prettus\Validator\Exceptions\ValidatorException
ResponseWasMorphed Event Listener
fire src/Framework/Dingo/Listeners/AddPaginationLinksToResponse
Auth Providers
add Passport
and improved Oauth2
Auth Providers
you can use with config
reference:
l5-Repository
improve
artisan command
auto generate below files
- Controller(
index
store
show
update
destory
trashedIndex
trashedShow
restore
) - Models(BaseModel with ObserveEvent auto track record modify with
create(update/delete)_at(by/ip)
) - Presenter
- Transformer(
league/fractal
) - Repositories/Criteria
- Repositories/Eloquent(BaseEloquent with ObserverEvents,Cacheable,SoftDeletes Support)
- Repositories/Interfaces
- Validator(prettus/laravel-validator support)
- migrations(new blueprint methods recordStamps[
create(update)_at(by/ip)
] softDeletesRecordStamps[delete_at(by/ip)
]) - Seeder
- append Route(file
routes/api.php(web.php)
with placeholder//:end-routes:
can auto-inject Restful api) - bind Repository Interface and Eloquent
Routes Endpoint
files routes/api.php
with placeholder //:end-routes:
Verb | URI | Action | Route Name |
---|---|---|---|
GET | /users |
index | users.index |
GET | /users/trashed |
trashedIndex | users.trashed.index |
POST | /users |
store | users.store |
GET | /users/{id} |
show | users.show |
GET | /users/trashed/{id} |
trashedShow | users.trashed.show |
PUT | /users/{id} |
update | users.update |
PUT | /users/{id}/restore |
restore | users.restore |
DELETE | /users/{id} |
destroy | users.destroy |
ObserveEvent
Models
and Repositories/Eloquent
has listen below methods events with $priority = 99
- onCreating()
- onCreated()
- onUpdating()
- onUpdated()
- onSaving()
- onSaved()
- onDeleting()
- onDeleted()
- onRestoring()
- onRestored()
Models also has default record track event listen
fields | default | description |
---|---|---|
$autoRelatedUserId | protect / true | Indicates if the model should be auto set user_id. |
$userstamps | protect / true | Indicates if the model should be recorded users. |
$ipstamps | protect / true | Indicates if the model should be recorded ips. |
RELATED_USER_ID | const / 'user_id' | The name of the "related user id" column. |
CREATED_BY | const / 'created_by' | The name of the "created by" column. |
UPDATED_BY | const / 'updated_by' | The name of the "updated by" column. |
CREATED_IP | const / 'created_ip' | The name of the "created ip" column. |
UPDATED_IP | const / 'updated_ip' | The name of the "updated ip" column. |
DELETED_IP | const / 'deleted_ip' | The name of the "deleted ip" column. |
DELETED_BY | const / 'deleted_by' | The name of the "deleted by" column. |
-
onCreating()
-
onSaving()
-
onDeleting()
- onRestoring()
Repositories/Eloquent
- SoftDeletes Support
- withTrashed
- withoutTrashed
- onlyTrashed
- restore
- restoreWhere
- ForceDelete
- forceDeleteWhere
reference:
Illuminate Database
improve
- support fulltext index
- add a set of blueprint methods
- add ipStamps(
create_ip
update_ip
) - add userStamps(
create_by
update_by
) - add recordStamps(
timestamps
ipStamps
userStamps
) - add softDeletesStamps(
delete_ip
delete_by
) - add softDeletesRecordStamps(
softDeletes
softDeletesStamps
) - add dropIpStamps
- add dropUserStamps
- add dropRecordStamps
- add dropSoftDeletesStamps
- add dropSoftDeletesRecordStamps
- add ipStamps(
laravel passport
Laravel
reference:
Lumen
Installed routes
Adding this service provider, will mount the following routes:
Verb | Path | NamedRoute | Controller | Action | Middleware |
---|---|---|---|---|---|
POST | /oauth/token | \Laravel\Passport\Http\Controllers\AccessTokenController | issueToken | - | |
GET | /oauth/tokens | \Laravel\Passport\Http\Controllers\AuthorizedAccessTokenController | forUser | auth | |
DELETE | /oauth/tokens/{token_id} | \Laravel\Passport\Http\Controllers\AuthorizedAccessTokenController | destroy | auth | |
POST | /oauth/token/refresh | \Laravel\Passport\Http\Controllers\TransientTokenController | refresh | auth | |
GET | /oauth/clients | \Laravel\Passport\Http\Controllers\ClientController | forUser | auth | |
POST | /oauth/clients | \Laravel\Passport\Http\Controllers\ClientController | store | auth | |
PUT | /oauth/clients/{client_id} | \Laravel\Passport\Http\Controllers\ClientController | update | auth | |
DELETE | /oauth/clients/{client_id} | \Laravel\Passport\Http\Controllers\ClientController | destroy | auth | |
GET | /oauth/scopes | \Laravel\Passport\Http\Controllers\ScopeController | all | auth | |
GET | /oauth/personal-access-tokens | \Laravel\Passport\Http\Controllers\PersonalAccessTokenController | forUser | auth | |
POST | /oauth/personal-access-tokens | \Laravel\Passport\Http\Controllers\PersonalAccessTokenController | store | auth | |
DELETE | /oauth/personal-access-tokens/{token_id} | \Laravel\Passport\Http\Controllers\PersonalAccessTokenController | destroy | auth |
Please note that some of the Laravel Passport's routes had to 'go away' because they are web-related and rely on sessions (eg. authorise pages). Lumen is an API framework so only API-related routes are present.
reference:
Ide-helper
Register service provider when
APP_ENV != production
Automatic phpDoc generation for Laravel Facades
Automatic phpDocs for models
PhpStorm Meta for Container instances
reference:
Clockwork
Register service provider when
APP_DUBUG = true
andAPP_ENV != production
reference:
Cors
Usage
The ServiceProvider adds a route middleware you can use, called cors
. You can apply this to a route or group to add CORS support.
If you want CORS to apply for all your routes, add it as global middleware in app/http/Kernel.php
:
reference:
License
The starter-framework is open-sourced software licensed under the MIT license.
All versions of starter-framework with dependencies
barryvdh/laravel-cors Version ^0.8.6
barryvdh/laravel-ide-helper Version ^2.3
dingo/api Version 1.0.x@dev
doctrine/dbal Version ^2.5
dusterio/lumen-passport Version ^0.1.9
itsgoingd/clockwork Version ^1.13
league/fractal Version ^0.15.0
overtrue/wechat Version ^3.2
prettus/l5-repository Version ^2.6