This guide is not a strict instruction. You don't have to follow every part of it.
Note: This repository contains the code needed to create a new connector of the DreamFactory platform. If you want the full DreamFactory platform, visit the main DreamFactory repository.
You are free to integrate anything Laravel provides, note that DreamFactory uses Laravel 5.6 version.
You can clone content of this repository to your own to get new functional connector of DreamFactory Platform.
To connect it to DF just add the following to the require section of main composer:
"require": {
"dreamfactory/df-skeleton": "~0.1.0" // instead of skeleton write name of your package
}
Then run composer require dreamfactory/df-skeleton update--no-dev --ignore-platform-reqs
Documentation for the platform can be found on the DreamFactory wiki.
First of all, your package composer need to require df-core and, in case of creating system service, df-system. Just add the following to the composer.json file of your package:
"require": {
"dreamfactory/df-core": "~0.15.1",
"dreamfactory/df-system": "~0.2.0"
}
./database
Things that concern database. For example migrations, if your package needs a table in system database.
./routes
If you need a non DF API route, you can describe it in routes.php file.
./src/Components
Any support classes, like wrappers or classes that implement the 3rd party packages functionality.
./src/Enum
In some cases you want to define a constant list of values. This is a food place to place them.
./src/Events
Your package can define events to subscribe to them later.
./src/Handlers/Events
Define event handlers or any other here.
-
./src/Http
Things that handle routes from./routes
folder../src/Http/Middleware
Requests middleware should go here.
./src/Http/Conrollers
Contollers of
./routes
should go here. -
./src/Models
Define Eloquent Models here.
./src/Resources
API Resources. It may extend DreamFactory\Core\Resources\BaseRestResource
from df-core.
./src/Services
Define your new Service here. It may also extend DreamFactory\Core\Services\BaseRestService
or any other base services from df-core.
./src/Testing
PHPUnit tests go here.
-
Service that extends
DreamFactory\Core\Services\BaseRestService
(see src/Services) -
Database table that describes your connector config (see database/migrations)
-
Model that connects to the table and extends
DreamFactory\Core\Models\BaseServiceConfigModel
(see src/Models). There is an opportunity to create connector not using database (see DreamFactory\Core\Models\BaseServiceConfigNoDbModel) -
Resource that extends
DreamFactory\Core\Resources\BaseRestResource
(see src/Resources)
For parent classes you can override methods to satisfy your needs.
In your resource and service you can override handleGET, handlePOST methods from df-core to determine responses (only if $autoDispatch = true;).
ServiceProvider connects the package to the application.
Remember you are not limited and you can implement anything Laravel provide.