Download the PHP package nikolag/core without Composer
On this page you can find all versions of the php package nikolag/core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package core
Short Description Nikolag Core package for Laravel payment integrations that are not part of the Cashier
License MIT
Informations about the package core
nikolag/core
Core package for building additional payment gateway integrations with nikolag
packages and Laravel >=5.5
Installation guide
composer require nikolag/core
Usage
This package contains all of the necessary code to get you started with building the additional integrations of payment gateways
with nikolag
packages. First of all there are couple of important layers and structure that you must follow:
- Configuration file
- Main service
- Dependency Injections
- Migrations and Factories
- Facades
- Models
- Providers
- Traits
- Tests
- Utility classes
1. Configuration file
Configuration file is the most important here since it'll contain all of the required pre-set options of your library. The file must be called nikolag.php and it must be inside of src/config folder.
This is just a starter snippet which u can start adapting to your own library. There are couple of important variables
that u gotta change and rules which you must follow.
Change {$default}
with the name of your package (paypal, payeer, payoneer, ...) and also include the fully qualified name (namespace) of your service instead of {$namespace}
. You can check nikolag.php example of how config file should look like.
SquareConfig.php is the example of how your configuration class should look like.
2. Main service
Your package must have at least 1 main service which is responsible for all communication between rest calls and your package. It also must extend Nikolag\Core\Abstracts\CorePaymentService and it must implement Nikolag\Core\Contracts\PaymentServiceContract thats explained in the next step. Example of that kind of class can be found SquareService.php.
3. Dependency Injections
Your library must have at least 1 contract which should be named {$serviceName}ServiceContract.php
where {$serviceName}
is the name of service you are trying to integrate with nikolag packages and Laravel
Also it must extends Nikolag\Core\Contracts\PaymentServiceContract.
Any other contract which is not connected with your service file in any way mustn't extend the above contract. Some examples of such name are PaypalServiceContract.php
, PayeerServiceContract.php
, PayoneerServiceContract.php
.
Example of the contract can be found SquareContract.php.
4. Migrations and Factories
All migrations and factories must be under src/database
folder and each of them respectively will have it's own subfolder src/database/factories
and src/database/migrations
.
This core package already has couple of migrations so you don't have to write them yourself, but you can extend on them if necessary.
5. Facades
All facades are found under src/facades
and your package must have at least 1 facade which must be alias for your main service class.
6. Models
All models must be located under src/models
. There are 2 core models: Customer and Transaction.
You must extend those 2 core models and create your own from them with all relationships available and also add
The above is only required for 2 base models, any other models u might make don't have to extend anything and you can create them normally. Example can be found Customer.php.
7. Providers
You can register multiple providers and they should be named respectively for their role in the library. You can find them under src/providers folder. Here are some examples: ExceptionServiceProvider, MyServiceProvider, ExternalLibrariesProvider, etc..
8. Traits
All traits must be under src/traits
.
9. Tests
All your tests must be under tests
and they are split into 2 types: integration
and unit
where each of them has it's own subfolder.
10. Utility classes
All your utility classes must be under src/utils
folder.
All available core methods
CoreService
CoreService examples
Get access to the specific underyling driver for any installed payment API
You can also charge the customer with your default driver
You can also list all available drivers
More examples
For a complete example of how to build upon this core package you can take a look at nikolag-core-starter
Contributing
Everyone is welcome to contribute to this repository, simply open up an issue and label the request, whether it is an issue, bug or a feature. For any other enquiries send an email to [email protected]
Contributors
Name | Changes | Date |
---|---|---|
@viangela84 | Updated order_product table pull request #3 | 2017-02-07 |
License
MIT License
Copyright (c) Nikola Gavrić [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
All versions of core with dependencies
illuminate/support Version 10.x
illuminate/config Version 10.x
illuminate/console Version 10.x
illuminate/contracts Version 10.x
illuminate/container Version 10.x
illuminate/database Version 10.x
illuminate/filesystem Version 10.x