Download the PHP package aaronjan/kobe without Composer

On this page you can find all versions of the php package aaronjan/kobe. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package kobe

Kobe

Kobe is a Swagger definition writing tool for PHP, it can be used with framework like Laravel or just native PHP.

Kobe can only generate definitions part of the Swagger Specification, so you must use this with a full-featured library like zircote/swagger-php (or just write those in PHP using array).

Why named "Kobe"? Well, I did a little research, according to the internet, Kobe Bryant has the most swagger, so I think Kobe knows the difinition of Swagger.

Notice

If you use swagger-php version 2.0.11 got schema not found error, see here.

Introduction

You must knew zircote/swagger-php. If you used it before, you may complain these things like me:

  1. How can I namespacing my definitions ?
  2. Why writing nested stuff is so painful ?! Why I have to write so many definitions just for nesting ?!!
  3. writing example value is killing me ..

Don't give up on Swagger, Kobe is here just for the defintions.

But first we have to know how Swagger works.

Swagger is a specification, it can be expressed in many ways, like YAML or JSON, commonly we use JSON in PHP. So whether you are using zircote/swagger-php or not, the final result is just a JSON string.

Therefore, you can write other Swagger stuff using zircote/swagger-php (because it's good for all of that but definitions), and using Kobe to organize your definitions,

Caution

Kobe currently doesn't have any test, although I haven't found any bug, but be careful. I'll writing some tests when I have time, or you can help this !

Installation

Install via Composer:

Example

Let's demostrate Kobe with a simple Laravel project.

First we create a folder app/Swagger/Definitions/ to store all our Definitions, and create a BaseDefinition in app/Swagger/BaseDefinition.php like below:

Kobe generate name for Definition using the class name by default (you can change this behavior), for example the name of your app\Swagger\Definitions\User\StoreResponse will be app.Swagger.Definitions.User.StoreResponse. Obviously writing ref="#/definitions/app.Swagger.Definitions.User.StoreResponse" is too wordy, so you can trim your class by returning a prefix in the getBaseNamespace() method.

All of our Definition will be extending from this BaseDefinition.

OK, here is our first real Definition:

app/Swagger/Definitions/Responses/ApiResponse.php

This will eventually be converted to JSON like this (only the definitions part remember ?):

You can write as many Definitions as you want, you can use Kobe whatever you want too, because it's just PHP !

For instance, a response that extends the ApiResponse:

app/Swagger/Definitions/Responses/FailureResponse.php

You can see, writing example for property is that easy.

Finally, we have to return the Swagger JSON:

But in the real world things are often more complex, let's write some more examples.

app/Swagger/Definitions/User.php

app/Swagger/Definitions/Article.php

app/Swagger/Definitions/ComplexStuff.php

This is the result:

Temp Definition automatically gets a random name (or you can set it manually), and will be parsed with all your other Definitions.

API


Kobe\Kobe

scanPSR4($directory, $namespace, $depth = 3)

parseDefinitions(array $definitionClasses, $mergeWithTemp = true)

makeInteger()

makeSchema()

makeItems()

makeLong()

makeFloat()

makeDouble()

makeString()

makeByte()

makeBinary()

makeBoolean()

makeDate()

makeDateTime()

makePassword()

makeObject()

makeArray()

makeTempDefinition($save = true)

makeTempDefinitionFrom($class, $save = true)

referenceByClass($class)

referenceByName($name)


Kobe\Schemas\Definition

getName()

getReference()

setAllOf($parents)

getAllOf()

toArray()

setExample($example)

getExample()

setTitle($title)

getTitle()

setDefault($default)

getDefault()

setDescription($description)

getDescription()

setProperty($name, Understandable $value)

setProperties($properties)

getProperties()

addRequired($required)

setRequired(array $required)

getRequired()

setAdditionalProperties($additionalProperties)

getAdditionalProperties()

setItems(\Kobe\Schemas\Items $items)

setReferenceAsItems(\Kobe\Schemas\Reference $reference)

getItems()

asInteger()

asSchema()

asItems()

asLong()

asFloat()

asDouble()

asString()

asByte()

asBinary()

asBoolean()

asDate()

asDateTime()

asPassword()

asObject()

asArray()

getType()

setType($type)

getFormat()

setFormat($format)


Kobe\Schemas\TempDefinition

Extended from the Kobe\Schemas\Definition.

setName($name)

originToArray()

Lisence

Licensed under the APACHE LISENCE 2.0.

Credits

Swagger

zircote/swagger-php


All versions of kobe with dependencies

PHP Build Version
Package Version
Requires symfony/finder Version 2.7.* || ~3.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aaronjan/kobe contains the following files

Loading the files please wait ....