Models

Item

ItemImageSettings

Configuration of item images

Namespace

Plenty\Legacy\Models\Item

Properties

Type Name Description
int cdnUrl
int maxAge
int imageExportPos
int defaultExport
int ftpImport
int ftpImportMatching
int neckermannExport
int attributeImageWidth
int attributeImageHeight
array name
array placeholder
array sizes
array aliases
array legacyPreviousSizes

Methods

public toArray()

Returns this model as an array.

Item

SalesPrice

SalesPriceSearchRepository

foo

Namespace

Plenty\Legacy\Repositories\Item\SalesPrice

Methods

public search(SalesPriceSearchRequest
 $request):SalesPriceSearchResponse
Parameters
SalesPriceSearchRequest $request
public searchAll(SalesPriceSearchRequest
 $request):array
Parameters
SalesPriceSearchRequest $request

Variation

DetectSalesPriceService

To be written...

Namespace

Plenty\Legacy\Services\Item\Variation

Methods

public getQuantity():void
public setQuantity($quantity):DetectSalesPriceService
Parameters
$quantity
public getCurrency():void
public setCurrency($currency):DetectSalesPriceService
Parameters
$currency
public getPlentyId():void
public setPlentyId($plentyId):DetectSalesPriceService
Parameters
$plentyId
public getOrderReferrer():void
public setOrderReferrer($orderReferrer):DetectSalesPriceService
Parameters
$orderReferrer
public getCustomerClass():void
public setCustomerClass($customerClass):DetectSalesPriceService
Parameters
$customerClass
public getType():void
public setType($type):DetectSalesPriceService
Parameters
$type
public getCountryOfDelivery():void
public setCountryOfDelivery($countryOfDelivery):DetectSalesPriceService
Parameters
$countryOfDelivery
public getAccountType():void
public setAccountType($accountType):DetectSalesPriceService
Parameters
$accountType
public getAccountId():void
public setAccountId($accountId):DetectSalesPriceService
Parameters
$accountId
public detect():void

SalesPriceService

To be written...

Namespace

Plenty\Legacy\Services\Item\Variation

Methods

public getUnitPrice(float $lot, float $price, string $unit):array
Parameters
float $lot
float $price
string $unit

Log

Contracts

LoggerContract

The contract for the logger.

Namespace

Plenty\Log\Contracts

Methods

public report(string $code, $additionalInfo = null):void

Report information.

Parameters
string $code
$additionalInfo
public debug(string $code, $additionalInfo = null):void

Detailed debug information.

Parameters
string $code
$additionalInfo
public info(string $code, $additionalInfo = null):void

Interesting events.

Parameters
string $code
$additionalInfo
public notice(string $code, $additionalInfo = null):void

Normal but significant events.

Parameters
string $code
$additionalInfo
public warning(string $code, $additionalInfo = null):void

Exceptional occurrences that are not errors.

Parameters
string $code
$additionalInfo
public error(string $code, $additionalInfo = null):void

Runtime errors that do not require immediate action but should typically be logged and monitored.

Parameters
string $code
$additionalInfo
public critical(string $code, $additionalInfo = null):void

Critical conditions.

Parameters
string $code
$additionalInfo
public alert(string $code, $additionalInfo = null):void

Action must be taken immediately.

Parameters
string $code
$additionalInfo
public emergency($code, $additionalInfo = null):void

System is unusable.

Parameters
$code
$additionalInfo
public logException(Exception
 $exception, int $traceDepth = 3):void

Log exceptions.

Parameters
Exception $exception
int $traceDepth The depth of the stack trace to be logged. Default is 3.
public setReferenceType(string $referenceType):LoggerContract

The reference type.

Parameters
string $referenceType
public setReferenceValue($referenceValue):LoggerContract

The reference value.

Parameters
$referenceValue
public addReference(string $referenceType, int $referenceValue):LoggerContract

Add reference.

Parameters
string $referenceType
int $referenceValue
public addPlaceholder(string $placeholderName, $placeholderValue):LoggerContract

Add code placeholder.

Parameters
string $placeholderName
$placeholderValue

Exceptions

ReferenceTypeException

Class ReferenceTypeException

Namespace

Plenty\Log\Exceptions

Methods

public __construct(string $message, int $code, Exception
 $previous = null):void
Parameters
string $message
int $code
Exception $previous

Models

Log

The log entity model

Namespace

Plenty\Log\Models

Properties

Type Name Description
string id The ID of the log entry
string createdAt The date when the log entry was created
string integration The integration key used for the log entry. Used as a first level allocation.
string identifier The identifier used for the log entry. Used as a second level allocation.
string code The code for this current log entry. For log entries with level "debug", "info", "notice", "warning" and "report" this needs to have an translation in order to be stored.
string referenceType Deprecated field, see the references field instead.
referenceValue Deprecated field, see the references field instead.
string level The level this current log entry belongs to. Notice! When storing log entries with level "report" the entries will actually be stored as level "info". The difference between "report" and "info" is that log entries with level "report" do not need prior activation.
additionalInfo Additional information that need to also be stored. Can be an int, string or object.
string callerFunction
int callerLine
array references All the reference types and values correlated with this log entry.

Methods

public toArray()

Returns this model as an array.

Services

ReferenceContainer

Register log reference types.

Namespace

Plenty\Log\Services

Methods

public add(array $referenceTypes):void

Use this method to add reference types.

Parameters
array $referenceTypes

Search

Contracts

LogRepositoryContract

Contract for logs.

Namespace

Plenty\Log\Search\Contracts

Methods

public search(int $page = 1, int $itemsPerPage = 50, array $filters = [], string $sortBy = "createdAt", string $sortOrder = "desc", array $with = []):FilteredPaginatedResult

Search logs with the given filters.

Parameters
int $page
int $itemsPerPage
array $filters
string $sortBy
string $sortOrder
array $with
public get($id):Log

Get log entry by id.

Parameters
$id

Plenty

Plugin

Application

The main application

Namespace

Plenty\Plugin

Methods

public register(string $providerClassName):void

Register a service provider with the application.

Parameters
string $providerClassName the classname with namespace of the provider
public bind(string $abstract, string $concrete = null, bool $shared = false):void

Register a binding with the container.

Parameters
string $abstract
string $concrete
bool $shared
public singleton(string $abstract, string $concrete = null):void

Register a shared binding in the container.

Parameters
string $abstract
string $concrete
public make(string $abstract, array $parameters = []):void
Parameters
string $abstract
array $parameters
public makeWith(string $abstract, array $parameters = []):void
Parameters
string $abstract
array $parameters
public abort(int $code, string $message = "", array $headers = []):void

Throw an HttpException with the given data.

Parameters
int $code
string $message
array $headers
public getWebstoreId():int

Returns current webstoreId

public getPlentyId():int
public isAdminPreview():bool
public isTemplateSafeMode():bool
public isBackendRequest():bool
public getPluginSetId():int
public getUrlPath(string $pluginName = ""):string

Returns the URL to the plugin resources

Parameters
string $pluginName
public getCdnDomain():string

Returns the URL from the cdn

public getPlentyHash():string

Returns the plentyHash

CachingRepository

caching repository

Namespace

Plenty\Plugin

Methods

public has(string $key):bool

Determine if an item exists in the cache.

Parameters
string $key
public get(string $key, $default = null):void

Retrieve an item from the cache by key.

Parameters
string $key
$default
public many(array $keys):array

Retrieve multiple items from the cache by key.

Parameters
array $keys
public pull(string $key, $default = null):void

Retrieve an item from the cache and delete it.

Parameters
string $key
$default
public put(string $key, $value, int $minutes = null):void

Store an item in the cache.

Parameters
string $key
$value
int $minutes
public putMany(array $values, int $minutes):void

Store multiple items in the cache for a given number of minutes.

Parameters
array $values
int $minutes
public add(string $key, $value, int $minutes):bool

Store an item in the cache if the key does not exist.

Parameters
string $key
$value
int $minutes
public remember(string $key, int $minutes, callable $callback):void

Get an item from the cache, or store the default value.

Parameters
string $key
int $minutes
callable $callback
public forget(string $key):bool

Remove an item from the cache.

Parameters
string $key
public static getPrefix():string

ConfigRepository

configuration repository

Namespace

Plenty\Plugin

Methods

public has(string $key):bool

Determine if the given configuration value exists.

Parameters
string $key
public get(string $key, $default = null):mixed

Get the specified configuration value.

Parameters
string $key
$default
public set(string $key, $value = null):void

Set a given configuration value.

Parameters
string $key
$value
public prepend(string $key, $value):void

Prepend a value onto an array configuration value.

Parameters
string $key
$value
public push(string $key, $value):void

Push a value onto an array configuration value.

Parameters
string $key
$value
public static getPrefix():string

Controller

Controller

Namespace

Plenty\Plugin

Methods

public __construct():void

Controller constructor.

DataExchangeServiceProvider

Data Exchange service provider

Namespace

Plenty\Plugin

Methods

public getApplication():Application
public getEventDispatcher():Dispatcher

Middleware

Middleware

Namespace

Plenty\Plugin

Methods

public before(Request
 $request):void
Parameters
Request $request
public after(Request
 $request, Response
 $response):Response
Parameters
Request $request
Response $response

RouteServiceProvider

Route service provider

Namespace

Plenty\Plugin

Methods

public getApplication():Application
public getEventDispatcher():Dispatcher

ServiceProvider

Service provider for plugins

Namespace

Plenty\Plugin

Methods

public addGlobalMiddleware(string $middleware):void

Add a new middleware to end of the stack if it does not already exist.

Parameters
string $middleware
public getApplication():Application
public getEventDispatcher():Dispatcher

SessionRepository

session repository

Namespace

Plenty\Plugin

Methods

public has(string $key):bool

Determine if the given session value exists.

Parameters
string $key
public get(string $key, $default = null):void

Get the specified session value.

Parameters
string $key
$default
public set(string $key, $value = null):void

Set a given session value.

Parameters
string $key
$value
public prepend(string $key, $value):void

Prepend a value onto an array session value.

Parameters
string $key
$value
public push(string $key, $value):void

Push a value onto an array session value.

Parameters
string $key
$value
public static getPrefix():string

Validation

DummyAttribute

Dummy Attribute Class

Namespace

Plenty\Validation

Methods

public getAttributeName():string
public setAttributeName(string $attributeName):Validation
Parameters
string $attributeName
public accepted():Validation

The field under validation must be yes, on, 1, or true. This is useful for validating "Terms of Service" acceptance.

public activeUrl():Validation

The field under validation must be a valid URL according to the checkdnsrr PHP function.

public dateAfter(string $fieldNameOrTimeStr):Validation

The field under validation must be a value after a given date. The dates will be passed into the strtotime PHP function.

Parameters
string $fieldNameOrTimeStr
public alphabetic():Validation

The field under validation must be entirely alphabetic characters.

public alphaDash():Validation

The field under validation may have alpha-numeric characters, as well as dashes and underscores.

public alphaNum():Validation

The field under validation must be entirely alpha-numeric characters.

public isArray():Validation

The field under validation must be a PHP array.

public dateBefore(string $fieldNameOrTimeStr):Validation

The field under validation must be a value preceding the given date. The dates will be passed into the PHP strtotime function.

Parameters
string $fieldNameOrTimeStr
public between(int $min, int $max):Validation

The field under validation must have a size between the given min and max. Strings, numerics, and files are evaluated in the same fashion as the size rule.

Parameters
int $min
int $max
public boolean():Validation

The field under validation must be able to be cast as a boolean. Accepted input are true, false, 1, 0, "1", and "0".

public confirmed():Validation

The field under validation must have a matching field of foo_confirmation. For example, if the field under validation is password, a matching password_confirmation field must be present in the input.

public date():Validation

The field under validation must be a valid date according to the strtotime PHP function.

public present():Validation

Validate that an attribute exists even if not filled.

public dateFormat(string $format):Validation

The field under validation must match the given format. The format will be evaluated using the PHP date_parse_from_format function.

Parameters
string $format
public different(string $fieldName):Validation

The field under validation must have a different value than field.

Parameters
string $fieldName
public digits(int $count):Validation

The field under validation must be numeric and must have an exact length of $count.

Parameters
int $count
public digitsBetween(int $min, int $max):Validation

The field under validation must have a length between the given min and max.

Parameters
int $min
int $max
public email():Validation

The field under validation must be formatted as an e-mail address.

public exists(string $table, array $columns = []):Validation

The field under validation must exist on a given database table.

Parameters
string $table
array $columns
public image():Validation

The file under validation must be an image (jpeg, png, bmp, gif, or svg)

public in(array $values):Validation

The field under validation must be included in the given list of values.

Parameters
array $values
public integer():Validation

The field under validation must be an integer.

public ip():Validation

The field under validation must be an IP address.

public json():Validation

The field under validation must a valid JSON string.

public max(int $value):Validation

The field under validation must be less than or equal to a maximum value. Strings, numerics, and files are evaluated in the same fashion as the size rule.

Parameters
int $value
public mimeTypes(array $types):Validation

The file under validation must have a MIME type corresponding to one of the listed extensions.

Parameters
array $types
public min(int $value):Validation

The field under validation must have a minimum value. Strings, numerics, and files are evaluated in the same fashion as the size rule.

Parameters
int $value
public notIn($values):Validation

The field under validation must not be included in the given list of values.

Parameters
$values
public numeric():Validation

The field under validation must be numeric.

public regex(string $pattern):Validation

The field under validation must match the given regular expression.

Parameters
string $pattern
public required():Validation

The field under validation must be present in the input data and not empty. A field is considered "empty" is one of the following conditions are true: The value is null.

public requiredIf(string $fieldName, $value):Validation

The field under validation must be present if the anotherfield field is equal to any value.

Parameters
string $fieldName
$value
public requiredUnless(string $fieldName, string $value):Validation

The field under validation must be present unless the anotherfield field is equal to any value.

Parameters
string $fieldName
string $value
public requiredWith(array $fieldNames):Validation

The field under validation must be present only if any of the other specified fields are present.

Parameters
array $fieldNames
public requiredWithAll(array $fieldNames):Validation

required_with_all

Parameters
array $fieldNames
public requiredWithout(array $fieldNames):Validation

The field under validation must be present only when any of the other specified fields are not present.

Parameters
array $fieldNames
public requiredWithoutAll(array $fieldNames):Validation

The field under validation must be present only when all of the other specified fields are not present.

Parameters
array $fieldNames
public notLike(string $fieldName):Validation

The field under validation must be not like the specified name.

Parameters
string $fieldName
public same(string $fieldName):Validation

The given field must match the field under validation.

Parameters
string $fieldName
public size(int $value):Validation

The field under validation must have a size matching the given value. For string data, value corresponds to the number of characters.

Parameters
int $value
public string():Validation

The field under validation must be a string.

public timezone():Validation

The field under validation must be a valid timezone identifier according to the timezone_identifiers_list PHP function.

public unique(string $table, string $column, string $except = null, string $idColumn = null):Validation

The field under validation must be unique on a given database table. If the column option is not specified, the field name will be used.

Parameters
string $table
string $column
string $except
string $idColumn
public url():Validation

The field under validation must be a valid URL according to PHP's filter_var function.

public sometimes():Validation

In some situations, you may wish to run validation checks against a field only if that field is present in the input array. To quickly accomplish this, add the sometimes rule.

public nullable():Validation

The field under validation may be null. This is particularly useful when validating primitive such as strings and integers that can contain null values.

public generateRulesContent():void
public dateW3C(bool $allowTimestamps = false):Validation

The field under validation must be a valid w3c formated date time string.

Parameters
bool $allowTimestamps Allow timestamps as a valid format as well.
public customRule(string $rule, array $params):Validation

Add custom Role

Parameters
string $rule
array $params
public validPlentyId():Validation

The field under validation must be a valid plentyId.

public validPlentyUrl():Validation

The field must be a valid URL.

public validPlentyDomain():Validation

Custom validation rule for checking the existence of a given domain.

public typeFromDb(string $table, string $column, string $attribute, string $comparisonKey = "id"):Validation

The field under validation must have the type specified in the database.

Parameters
string $table The table with the data type
string $column The column with the data type
string $attribute The attribute in the validator with the key
string $comparisonKey The column to in $table to compare $attribute to. Default is 'id'.
public hexColor():void
public rgbColor():void
public cssColor():void
public color():void
public uuid5():void
public validDbType():Validation

The field under validation must be a valid data type used by the validation rule 'typeFromDb'.

public validCurrency():Validation

The field under validation must be a valid currency string (e.g. 'EUR').

public validBoardTaskReferenceValue():Validation

The field under validation must be a valid board task reference type (e.g. {@link BoardTaskReferenceType::CONTACT}).

RulesCollection

RulesCollection

Namespace

Plenty\Validation

Methods

public add(string $attributeName):Attribute
Parameters
string $attributeName
public addConditional(string $attributeName, bool $required):Attribute
Parameters
string $attributeName
bool $required
public addInt(string $attributeName, bool $required = false):Attribute
Parameters
string $attributeName
bool $required
public addNumeric(string $attributeName, bool $required = false):Attribute
Parameters
string $attributeName
bool $required
public addDate(string $attributeName, bool $required = false):Attribute
Parameters
string $attributeName
bool $required
public addBool(string $attributeName, bool $required = false):Attribute
Parameters
string $attributeName
bool $required
public addString(string $attributeName, bool $required = false):Attribute
Parameters
string $attributeName
bool $required
public sometimes(string $attributeName, callable $condition):Attribute

Add a rule for an attribute based on the result of the condition callback.

Parameters
string $attributeName
callable $condition

Validator

Base Validator Class

Namespace

Plenty\Validation

Properties

Type Name Description
customMessageKey

Methods

public static validateOrFail(array $data):void
Parameters
array $data
public each(string $attributeName):RulesCollection
Parameters
string $attributeName
public buildCustomMessages():array
public getAttributeValue(string $attribute):void

Get the value of the given attribute.

Parameters
string $attribute
public defineAttributes():void
public add(string $attributeName):Attribute
Parameters
string $attributeName
public addConditional(string $attributeName, bool $required):Attribute
Parameters
string $attributeName
bool $required
public addInt(string $attributeName, bool $required = false):Attribute
Parameters
string $attributeName
bool $required
public addNumeric(string $attributeName, bool $required = false):Attribute
Parameters
string $attributeName
bool $required
public addDate(string $attributeName, bool $required = false):Attribute
Parameters
string $attributeName
bool $required
public addBool(string $attributeName, bool $required = false):Attribute
Parameters
string $attributeName
bool $required
public addString(string $attributeName, bool $required = false):Attribute
Parameters
string $attributeName
bool $required
public sometimes(string $attributeName, callable $condition):Attribute

Add a rule for an attribute based on the result of the condition callback.

Parameters
string $attributeName
callable $condition

Exceptions

ValidationException

Namespace

Plenty\Exceptions

Properties

Type Name Description
messageBag

Methods

public getMessageBag():MessageBag
public setMessageBag(MessageBag
 $messageBag):Exceptions
Parameters
MessageBag $messageBag

Plugin

Build

CheckProcess

check process

Namespace

Plenty\Plugin\Build

Methods

public addError(string $message):void
Parameters
string $message

Error

HTTPException

Created by ptopczewski, 29.12.15 13:48 Class HTTPException

Namespace

Plenty\Plugin\Error

Methods

public __construct(string $statusCode, string $message, Exception
 $previous = null):void

HTTPException constructor.

Parameters
string $statusCode
string $message
Exception $previous

Events

Dispatcher

Dispatcher

Namespace

Plenty\Plugin\Events

Methods

public isPublicEvent(string $event):bool
Parameters
string $event
public listen($event, $listener, int $priority):void

Register an event listener with the dispatcher.

Parameters
$event
$listener
int $priority
public hasListeners($event):bool

Determine if a given event has listeners.

Parameters
$event
public fire($event, array $payload = []):void

Fire an event and call the listeners.

Parameters
$event
array $payload
public dispatch($event, array $payload = []):void

Fire an event and call the listeners.

Parameters
$event
array $payload
public forget($event):void

Remove a set of listeners from the dispatcher.

Parameters
$event
public static getPrefix():string

Event

Event

Namespace

Plenty\Plugin\Events

ShouldQueue

Class that allows plugin event listeners to be queued.

Namespace

Plenty\Plugin\Events

Http

Request

http request

Namespace

Plenty\Plugin\Http

Methods

public all():array

Get all of the input and files for the request.

public merge(array $input):void

Merge new input into the current request's input array.

Parameters
array $input
public replace(array $input):void

Replace the input for the current request.

Parameters
array $input
public get(string $key, $default = null, bool $deep = false):void
Parameters
string $key
$default
bool $deep
public getContent():string

Returns the request body content.

public getRequestUri():string

Returns the requested URI (path and query string).

public exists($key):bool

Determine if the request contains a given input item key.

Parameters
$key
public has($key):bool

Determine if the request contains a non-empty value for an input item.

Parameters
$key
public input(string $key = null, $default = null):void

Retrieve an input item from the request.

Parameters
string $key
$default
public only($keys):array

Get a subset of the items from the input data.

Parameters
$keys
public except($keys):array

Get all of the input except for a specified array of items.

Parameters
$keys
public query(string $key = null, $default = null):void

Retrieve a query string item from the request.

Parameters
string $key
$default
public hasHeader(string $key):bool

Determine if a header is set on the request.

Parameters
string $key
public header(string $key = null, $default = null):void

Retrieve a header from the request.

Parameters
string $key
$default
public isJson():bool

Determine if the request is sending JSON.

public wantsJson():bool

Determine if the current request is asking for JSON in return.

public accepts($contentTypes):bool

Determines whether the current requests accepts a given content type.

Parameters
$contentTypes
public prefers($contentTypes):string

Return the most suitable content type from the given array based on content negotiation.

Parameters
$contentTypes
public acceptsJson():bool

Determines whether a request accepts JSON.

public acceptsHtml():bool

Determines whether a request accepts HTML.

public format(string $default = "html"):string

Get the data format expected in the response.

Parameters
string $default
public getUserInfo():string

Gets the user info.

public getHttpHost():string

Returns the HTTP host being requested.

public getSchemeAndHttpHost():string

Gets the scheme and HTTP host.

public getUri():string

Generates a normalized URI (URL) for the Request.

public getUriForPath(string $path):string

Generates a normalized URI for the given path.

Parameters
string $path A path to use instead of the current one
public getQueryString():string

Generates the normalized query string for the Request.

public getMethod():string

Gets the request "intended" method.

public getLocale():string

Get the locale.

Response

Class to create different types of http response.

Namespace

Plenty\Plugin\Http

Methods

public status():int

Get the status code for the response.

public content():string

Get the content of the response.

public make(string $content = "", int $status = 200, array $headers = []):Response

Return a new response from the application.

Parameters
string $content
int $status
array $headers
public view(string $view, array $data = [], int $status = 200, array $headers = []):Response

Return a new view response from the application.

Parameters
string $view
array $data
int $status
array $headers
public json($data = [], int $status = 200, array $headers = [], int $options):Response

Return a new JSON response from the application.

Parameters
$data
int $status
array $headers
int $options
public jsonp(string $callback, $data = [], int $status = 200, array $headers = [], int $options):Response

Return a new JSONP response from the application.

Parameters
string $callback
$data
int $status
array $headers
int $options
public stream(callable $callback, int $status = 200, array $headers = []):Response

Return a new streamed response from the application.

Parameters
callable $callback
int $status
array $headers
public redirectTo(string $path, int $status = 302, array $headers = [], bool $secure = null):Response

Create a new redirect response to the given path.

Parameters
string $path
int $status
array $headers
bool $secure
public redirectToRoute(string $route, array $parameters = [], int $status = 302, array $headers = []):Response

Create a new redirect response to a named route.

Parameters
string $route
array $parameters
int $status
array $headers
public redirectToAction(string $action, array $parameters = [], int $status = 302, array $headers = []):Response

Create a new redirect response to a controller action.

Parameters
string $action
array $parameters
int $status
array $headers
public redirectGuest(string $path, int $status = 302, array $headers = [], bool $secure = null):Response

Create a new redirect response, while putting the current URL in the session.

Parameters
string $path
int $status
array $headers
bool $secure
public redirectToIntended(string $default = "/", int $status = 302, array $headers = [], bool $secure = null):Response

Create a new redirect response to the previously intended location.

Parameters
string $default
int $status
array $headers
bool $secure
public sendHeaders():Http

Send the HTTP headers without sending the whole response.

public forceStatus(int $status = 200):Http

Force sending response with defined status instead of falling back to default handlers in case of 40* status codes.

Parameters
int $status
public isStatusForced():bool

Check if response should be send instead of falling back to default handlers in case of 40* status codes.

Log

LoggerFactory

Logger factory

Namespace

Plenty\Plugin\Log

Methods

public getLogger(string $pluginNamespace, string $identifier):LoggerContract
Parameters
string $pluginNamespace
string $identifier

Routing

ApiRouter

Api router service

Namespace

Plenty\Plugin\Routing

Methods

public version(array $version, $second, $third = null):void
Parameters
array $version
$second
$third
public get(string $uri, $action):Route

Register a new GET route with the router.

Parameters
string $uri
$action
public post(string $uri, $action):Route

Register a new POST route with the router.

Parameters
string $uri
$action
public put(string $uri, $action):Route

Register a new PUT route with the router.

Parameters
string $uri
$action
public patch(string $uri, $action):Route

Register a new PATCH route with the router.

Parameters
string $uri
$action
public delete(string $uri, $action):Route

Register a new DELETE route with the router.

Parameters
string $uri
$action
public options(string $uri, $action):Route

Register a new OPTIONS route with the router.

Parameters
string $uri
$action
public any(string $uri, $action):Route

Register a new route responding to all verbs.

Parameters
string $uri
$action
public resource(string $name, string $controller, array $options = []):void

Route a resource to a controller.

Parameters
string $name
string $controller
array $options
public match(array $methods, string $uri, $action):Route

Register a new route with the given verbs.

Parameters
array $methods
string $uri
$action

Route

Route

Namespace

Plenty\Plugin\Routing

Methods

public addMiddleware(array $middleware):Routing

Add middlewares attached to the route.

Parameters
array $middleware
public middleware(array $middleware = []):Routing

Get or set the middlewares attached to the route.

Parameters
array $middleware
public getMiddleware():array
public where(string $name, $expression = null):Routing
Parameters
string $name
$expression

Router

Router service

Namespace

Plenty\Plugin\Routing

Methods

public static addRoute($route):void
Parameters
$route
public get(string $uri, $action):Route

Register a new GET route with the router.

Parameters
string $uri
$action
public post(string $uri, $action):Route

Register a new POST route with the router.

Parameters
string $uri
$action
public put(string $uri, $action):Route

Register a new PUT route with the router.

Parameters
string $uri
$action
public patch(string $uri, $action):Route

Register a new PATCH route with the router.

Parameters
string $uri
$action
public delete(string $uri, $action):Route

Register a new DELETE route with the router.

Parameters
string $uri
$action
public options(string $uri, $action):Route

Register a new OPTIONS route with the router.

Parameters
string $uri
$action
public any(string $uri, $action):Route

Register a new route responding to all verbs.

Parameters
string $uri
$action
public match(array $methods, string $uri, $action):Route

Register a new route with the given verbs.

Parameters
array $methods
string $uri
$action
public middleware(string $name, string $class):Routing

Register a short-hand name for a middleware.

Parameters
string $name
string $class
public prepareResponse(Request
 $request, Response
 $response):Response

Create a response instance from the given value.

Parameters
Request $request
Response $response

Templates

Markdown

A simple markdown converter.

Namespace

Plenty\Plugin\Templates

Methods

public renderToHtml(string $markdownContent):string
Parameters
string $markdownContent

Twig

Twig engine

Namespace

Plenty\Plugin\Templates

Methods

public render(string $name, array $context = []):string

Renders a template.

Parameters
string $name The template name
array $context An array of parameters to pass to the template
public renderString(string $templateContent, array $context = []):string

Renders a template from a string.

Parameters
string $templateContent The template to render
array $context An array of parameters to pass to the template
public addExtension(string $extension):void

Registers an extension.

Parameters
string $extension A Twig_ExtensionInterface instance

View

view support

Namespace

Plenty\Plugin\Templates

Methods

public render(string $templatePath, array $data = []):string
Parameters
string $templatePath
array $data
public exists(string $templatePath):bool
Parameters
string $templatePath

Translation

Translator

translation service

Namespace

Plenty\Plugin\Translation

Methods

public get(string $id, array $parameters = [], string $locale = null):void

Get the translation for a given key.

Parameters
string $id
array $parameters
string $locale
public trans(string $id, array $parameters = [], string $locale = null):void

Get the translation for a given key.

Parameters
string $id
array $parameters
string $locale

Data

Contracts

PropertyDescriptor

describes properties of a Model

Namespace

Plenty\Plugin\Data\Contracts

Methods

public getPropertyInformation(string $modelClassName):array
Parameters
string $modelClassName

Resources

Resource

Namespace

Plenty\Plugin\Data\Contracts

Methods

public load(string $resourceName, array $options = []):ResourceInformation
Parameters
string $resourceName
array $options [optional]
public exists(string $resourceName):bool
Parameters
string $resourceName

Model

PropertyInformation

property information

Namespace

Plenty\Plugin\Data\Model

Methods

public getType():string
public getName():string
public getDescription():string

ResourceInformation

resource information

Namespace

Plenty\Plugin\Data\Model

Methods

public getPath():string
public getContentUrl():string
public getData():void

ExternalAuth

Contracts

ExternalAccessRepositoryContract

Find and create ExternalAccess-datasets

Namespace

Plenty\Plugin\ExternalAuth\Contracts

Methods

public create(array $data):ExternalAccess

Create a new ExternalAccess record

Parameters
array $data The data for the ExternalAccess record to be created with. Must be an associative array with the keys 'contactId', 'accessType', 'externalContactId' and optionally an external 'accessToken'.
public findForTypeAndExternalId(string $type, string $externalId):ExternalAccess

Find

Parameters
string $type The type of the external access
string $externalId The external ID of the contact
public findForTypeAndContactId(string $type, int $contactId):ExternalAccess
Parameters
string $type The type of the external access
int $contactId The (internal) ID of the contact

Models

ExternalAccess

Information on a contact's external access tokens

Namespace

Plenty\Plugin\ExternalAuth\Models

Properties

Type Name Description
int contactId The ID of the contact in question. Must be unique in combination with $accessType.
string accessType The type/provider of external access. Must be unique in combination with $contactId.
string externalContactId The ID of the contact at the external provider.
string accessToken The token for the external access.
Carbon lastUpdate The Date when this record was updated the last time.

Methods

public toArray()

Returns this model as an array.

Services

ExternalAuthService

Log in users with external auth

Namespace

Plenty\Plugin\ExternalAuth\Services

Methods

public logInWithExternalUserId(string $externalId, string $type):void
Parameters
string $externalId
string $type

Mail

Contracts

AwsSesContract

Plugin AWS Simple Email Service

Namespace

Plenty\Plugin\Mail\Contracts

Methods

public sendEmail(Email
 $email, AwsSesCredentials
 $credentials):EmailSenderResult

Composes an email message and immediately queues it for sending via AWS SES

Parameters
Email $email
AwsSesCredentials $credentials

MailerContract

Plugin Mailer Service

Namespace

Plenty\Plugin\Mail\Contracts

Methods

public sendHtml(string $html, $recipients, string $subject = "", array $cc = [], array $bcc = [], ReplyTo
 $replyTo = null, array $attachments = []):void

Send an email containing html

Parameters
string $html The HTML-String for the email body
$recipients Either a string containing a single email address or an array of strings containing multiple email addresses
string $subject Optional. The subject of the message
array $cc Optional. Array of strings containing email addresses which the message should be sent to as cc
array $bcc Optional. Array of strings containing email addresses which the message should be sent to as bcc
ReplyTo $replyTo Optional. ReplyToRecipient model with mailaddress and name attributes
array $attachments Optional. A list of StorageObject objects ( see Plenty\Modules\Plugin\Storage\Contracts\StorageRepositoryContract )
public sendFromTwig(string $twigPath, array $data, $recipients, string $subject = "", array $altConfig = [], array $cc = [], array $bcc = [], ReplyTo
 $replyTo = null, array $attachments = []):void

Send an email that will get rendered by twig

Parameters
string $twigPath The path to the twig template file that should be used to render the mail. E.g.: 'PluginNamespace::mail.my_mail'
array $data An associative array of data that will be available to the twig template
$recipients Either a string containing a single email address or an array of strings containing multiple email addresses
string $subject Optional. The subject of the message
array $altConfig Optional. Alternative email config. If present MUST be an associative array with the keys 'host', 'port', 'username', 'password' and 'encryption'. It CAN optionally have a key 'from' to set the sender-address to something else than specified in the system config. If 'from' is missing, the system-wide configured sender-address is used.
array $cc Optional. Array of strings containing email addresses which the message should be sent to as cc
array $bcc Optional. Array of strings containing email addresses which the message should be sent to as bcc
ReplyTo $replyTo Optional. ReplyToRecipient model with mailaddress and name attributes
array $attachments Optional. A list of StorageObject objects ( see Plenty\Modules\Plugin\Storage\Contracts\StorageRepositoryContract )
public sendFromMime(string $mimeMessage, $recipients, array $altConfig = [], array $cc = [], array $bcc = [], ReplyTo
 $replyTo = null, array $attachments = []):void

Send given message as email

Parameters
string $mimeMessage Complete email mime source header included
$recipients Either a string containing a single email address or an array of strings containing multiple email addresses
array $altConfig Optional. Alternative email config. If present MUST be an associative array with the keys 'host', 'port', 'username', 'password' and 'encryption'. It CAN optionally have a key 'from' to set the sender-address to something else than specified in the system config. If 'from' is missing, the system-wide configured sender-address is used.
array $cc Optional. Array of strings containing email addresses which the message should be sent to as cc
array $bcc Optional. Array of strings containing email addresses which the message should be sent to as bcc
ReplyTo $replyTo Optional. ReplyToRecipient model with mailaddress and name attributes
array $attachments Optional. A list of StorageObject objects ( see Plenty\Modules\Plugin\Storage\Contracts\StorageRepositoryContract )

Models

AwsSesCredentials

the credential model for AWS SES client.

Namespace

Plenty\Plugin\Mail\Models

Properties

Type Name Description
string region AWS region e.g. eu-west-1
string accessKeyId User access key
string secretAccessKey User secret access key

Methods

public toArray()

Returns this model as an array.

Email

the email model.

Namespace

Plenty\Plugin\Mail\Models

Properties

Type Name Description
array bccAddresses BCC email address
array ccAddresses CC email address
array toAddresses To email address
string senderAddress Sender email address
array replyToAddresses Reply to email address
string subject Email subject
string htmlBody HTML email body
string plainTextBody Plain text email body
string rawMessage MIME message, if set subject, html and plainText are ignored

Methods

public toArray()

Returns this model as an array.

EmailSenderResult

the email sender result model.

Namespace

Plenty\Plugin\Mail\Models

Properties

Type Name Description
int messageId
string message
int errorCode

Methods

public toArray()

Returns this model as an array.

ReplyTo

ReplyTo

Namespace

Plenty\Plugin\Mail\Models

Properties

Type Name Description
string mailAddress The mail address to reply.
string name The name to reply.

Methods

public toArray()

Returns this model as an array.

Templates

Extensions

TwigFilter

TwigFilter

Namespace

Plenty\Plugin\Templates\Extensions

TwigFunction

TwigFunction

Namespace

Plenty\Plugin\Templates\Extensions

Twig_Extension

Twig extension

Namespace

Plenty\Plugin\Templates\Extensions

Methods

public getName():string
public getGlobals():void

Twig_SimpleFilter

Twig SimpleFilter

Namespace

Plenty\Plugin\Templates\Extensions

Twig_SimpleFunction

Twig SimpleFunction

Namespace

Plenty\Plugin\Templates\Extensions

Factories

TwigFactory

Twig Factory

Namespace

Plenty\Plugin\Templates\Factories

Methods

public register():void
public createSimpleFunction(string $name, $callable, array $params = []):Twig_SimpleFunction
Parameters
string $name
$callable
array $params An array of parameters
public createSimpleFilter(string $name, $callable, array $params = []):Twig_SimpleFilter
Parameters
string $name
$callable
array $params An array of parameters

Repositories

Contracts

DeleteResponseContract

DeleteResponse Interface

Namespace

Plenty\Repositories\Contracts

Methods

public getAffectedRows():int
public setAffectedRows(int $value):void
Parameters
int $value
public increment():int
public decrement():int

PaginationResponseContract

Contract for PaginationResponse

Namespace

Plenty\Repositories\Contracts

Methods

public getTotal():void
public setTotal($total):void
Parameters
$total
public getPage():void
public setPage($page):void
Parameters
$page
public getEntriesPerPage():void
public setEntriesPerPage($epp):void
Parameters
$epp
public getResult():void
public setResult($entries):void
Parameters
$entries
public toJson(int $options):string

Convert the object to its JSON representation.

Parameters
int $options
public toArray():array

Get the instance as an array.

Criteria

Comparison

comparison class

Namespace

Plenty\Repositories\Criteria

Methods

public getOperator():string
public getTerm():void
public isOperator(string $comparison):bool
Parameters
string $comparison
public castTerm(string $castTo):void
Parameters
string $castTo

PluginCriteria

The contract for defining criteria.

Namespace

Plenty\Repositories\Criteria

Methods

public comparisons():array
public apply($builder, CriteriableContract
 $repository):void
Parameters
$builder
CriteriableContract $repository
public allowedComparators():array

Models

DeleteResponse

Delete Response

Namespace

Plenty\Repositories\Models

Properties

Type Name Description
int affectedRows

Methods

public toArray()

Returns this model as an array.

FilteredPaginatedResult

Filtered paginated result

Namespace

Plenty\Repositories\Models

Methods

public getFilters():array
public setFilters(array $filters):void
Parameters
array $filters
public toArray():array

Get the instance as an array.

public paginate():Models
public getPage():int

Returns the page number as received

public getCurrentPage():int

Returns the normalized page number - checked if out of logical bounds ( not below 0, not greater than the last page ) and adjusted

public getTotalCount():int
public isLastPage():bool
public getItemIndexFrom():int
public getItemIndexTo():int
public getLastPage():int
public getResult():array
public setResult($result):void
Parameters
$result
public toJson(int $options):string

Convert the object to its JSON representation.

Parameters
int $options
public jsonSerialize():void

Specify data which should be serialized to JSON

PaginatedResult

paginated result

Namespace

Plenty\Repositories\Models

Methods

public paginate():Models
public getPage():int

Returns the page number as received

public getCurrentPage():int

Returns the normalized page number - checked if out of logical bounds ( not below 0, not greater than the last page ) and adjusted

public getTotalCount():int
public isLastPage():bool
public getItemIndexFrom():int
public getItemIndexTo():int
public getLastPage():int
public getResult():array
public setResult($result):void
Parameters
$result
public toArray():array

Get the instance as an array.

public toJson(int $options):string

Convert the object to its JSON representation.

Parameters
int $options
public jsonSerialize():void

Specify data which should be serialized to JSON

Services

RequestPaginationOptionsProvider

Array pagination

Namespace

Plenty\Repositories\Services

Methods

public setCurrentItemsPerPage(int $currentItemsPerPage):Services
Parameters
int $currentItemsPerPage
public setCurrentPage(int $currentPage):Services
Parameters
int $currentPage
public getCurrentItemsPerPage():int
public getCurrentPage():int

SimpleArrayPagination

Array pagination

Namespace

Plenty\Repositories\Services

Methods

public buildResult(int $page, int $offset):Collection
Parameters
int $page
int $offset
public getTotalCount():int

Criteria

Containers

CriteriaContainer

Register repository criteria

Namespace

Plenty\Repositories\Criteria\Containers

Methods

public add(string $repository, string $criteria, string $key):Containers

Use this method to add criteria to a existing repository.

Parameters
string $repository The repository that should use the criteria
string $criteria The criteria class name that should be used.
string $key The key that should match the given criteria.

Contracts

CriteriableContract

Interface which provides the possibility to use Criteria filters.

Namespace

Plenty\Repositories\Criteria\Contracts

Methods

public clearCriteria():void

Resets all Criteria filters by creating a new instance of the builder object.

public applyCriteriaFromFilters():void

Applies criteria classes to the current repository.

ExtendsCriteriaContract

Interface which provides the possibility to extends repositories with new Criteria filters.

Namespace

Plenty\Repositories\Criteria\Contracts

Validation

Contracts

Attribute

Attribute Interface

Namespace

Plenty\Validation\Contracts

Methods

public getAttributeName():string
public setAttributeName(string $attributeName):Contracts
Parameters
string $attributeName
public accepted():Contracts

The field under validation must be yes, on, 1, or true. This is useful for validating "Terms of Service" acceptance.

public customRule(string $rule, array $params):Contracts

Add custom Role

Parameters
string $rule
array $params
public activeUrl():Contracts

The field under validation must be a valid URL according to the checkdnsrr PHP function.

public dateAfter(string $fieldNameOrTimeStr):Contracts

The field under validation must be a value after a given date. The dates will be passed into the strtotime PHP function. Instead of passing a date string to be evaluated by strtotime, you may specify another field to compare against the date

Parameters
string $fieldNameOrTimeStr
public alphabetic():Contracts

The field under validation must be entirely alphabetic characters.

public alphaDash():Contracts

The field under validation may have alpha-numeric characters, as well as dashes and underscores.

public alphaNum():Contracts

The field under validation must be entirely alpha-numeric characters.

public isArray():Contracts

The field under validation must be a PHP array.

public dateBefore(string $fieldNameOrTimeStr):Contracts

The field under validation must be a value preceding the given date. The dates will be passed into the PHP strtotime function.

Parameters
string $fieldNameOrTimeStr
public between(int $min, int $max):Contracts

The field under validation must have a size between the given min and max. Strings, numerics, and files are evaluated in the same fashion as the size rule.

Parameters
int $min
int $max
public boolean():Contracts

The field under validation must be able to be cast as a boolean. Accepted input are true, false, 1, 0, "1", and "0".

public confirmed():Contracts

The field under validation must have a matching field of foo_confirmation. For example, if the field under validation is password, a matching password_confirmation field must be present in the input.

public present():Contracts

Validate that an attribute exists even if not filled.

public date():Contracts

The field under validation must be a valid date according to the strtotime PHP function.

public dateFormat(string $format):Contracts

The field under validation must match the given format. The format will be evaluated using the PHP date_parse_from_format function. You should use either date or date_format when validating a field, not both.

Parameters
string $format
public dateW3C(bool $allowTimestamps = false):Contracts

The field under validation must be a valid w3c formated date time string.

Parameters
bool $allowTimestamps Allow timestamps as a valid format as well.
public validPlentyId():Contracts

The field under validation must be a valid plentyId.

public validPlentyUrl():Contracts

The field under validation must be a valid plentyId.

public validPlentyDomain():Contracts

The field under validation must be a unique domain.

public typeFromDb(string $table, string $column, string $attribute, string $comparisonKey = "id"):Contracts

The field under validation must have the type specified in the database.

Parameters
string $table The table with the data type
string $column The column with the data type
string $attribute The attribute in the validator with the key
string $comparisonKey The column to in $table to compare $attribute to. Default is 'id'.
public hexColor():Attribute

The field under validation must be a valid HEX color (like "#a3d" or "#a0787c").

public rgbColor():Attribute

The field under validation must be a valid RGB or RGBA color (like "rgb(0, 200, 150)" or "rgba(0, 200, 150, 0.52)").

public cssColor():Attribute

The field under validation must be a valid predefined CSS color (like "aquamarine" or "skyblue").

public color():Attribute

The field under validation must be a valid color (HEX like "#a0787c", RGB like "rgb(0, 200, 150)" or CSS like "aquamarine")

public uuid5():Attribute

The field under validation must be a valid UUID version 5.

public validDbType():Contracts

The field under validation must be a valid data type used by the validation rule 'typeFromDb'.

public validCurrency():Contracts

The field under validation must be a valid currency string (e.g. 'EUR').

public different(string $fieldName):Contracts

The field under validation must have a different value than field.

Parameters
string $fieldName
public digits(int $count):Contracts

The field under validation must be numeric and must have an exact length of $count.

Parameters
int $count
public digitsBetween(int $min, int $max):Contracts

The field under validation must have a length between the given min and max.

Parameters
int $min
int $max
public email():Contracts

The field under validation must be formatted as an e-mail address.

public exists(string $table, array $columns = []):Contracts

The field under validation must exist on a given database table.

Parameters
string $table
array $columns
public image():Contracts

The file under validation must be an image (jpeg, png, bmp, gif, or svg)

public in(array $values):Contracts

The field under validation must be included in the given list of values.

Parameters
array $values
public integer():Contracts

The field under validation must be an integer.

public ip():Contracts

The field under validation must be an IP address.

public json():Contracts

The field under validation must a valid JSON string.

public max(int $value):Contracts

The field under validation must be less than or equal to a maximum value. Strings, numerics, and files are evaluated in the same fashion as the size rule.

Parameters
int $value
public mimeTypes(array $types):Contracts

The file under validation must have a MIME type corresponding to one of the listed extensions.

Parameters
array $types
public min(int $value):Contracts

The field under validation must have a minimum value. Strings, numerics, and files are evaluated in the same fashion as the size rule.

Parameters
int $value
public notIn($values):Contracts

The field under validation must not be included in the given list of values.

Parameters
$values
public numeric():Contracts

The field under validation must be numeric.

public regex(string $pattern):Contracts

The field under validation must match the given regular expression.

Parameters
string $pattern
public required():Contracts

The field under validation must be present in the input data and not empty. A field is considered "empty" is one of the following conditions are true: The value is null. The value is an empty string. The value is an empty array or empty Countable object. The value is an uploaded file with no path.

public requiredIf(string $fieldName, $value):Contracts

The field under validation must be present if the anotherfield field is equal to any value.

Parameters
string $fieldName
$value
public requiredUnless(string $fieldName, string $value):Contracts

The field under validation must be present unless the anotherfield field is equal to any value.

Parameters
string $fieldName
string $value
public requiredWith(array $fieldNames):Contracts

The field under validation must be present only if any of the other specified fields are present.

Parameters
array $fieldNames
public requiredWithAll(array $fieldNames):Contracts

required_with_all

Parameters
array $fieldNames
public requiredWithout(array $fieldNames):Contracts

The field under validation must be present only when any of the other specified fields are not present.

Parameters
array $fieldNames
public requiredWithoutAll(array $fieldNames):Contracts

The field under validation must be present only when all of the other specified fields are not present.

Parameters
array $fieldNames
public notLike(string $fieldName):Contracts

The field under validation must be not like the specified name.

Parameters
string $fieldName
public same(string $fieldName):Contracts

The given field must match the field under validation.

Parameters
string $fieldName
public size(int $value):Contracts

The field under validation must have a size matching the given value. For string data, value corresponds to the number of characters. For numeric data, value corresponds to a given integer value. For files, size corresponds to the file size in kilobytes.

Parameters
int $value
public string():Contracts

The field under validation must be a string.

public timezone():Contracts

The field under validation must be a valid timezone identifier according to the timezone_identifiers_list PHP function.

public unique(string $table, string $column, string $except = null, string $idColumn = null):Contracts

The field under validation must be unique on a given database table. If the column option is not specified, the field name will be used.

Parameters
string $table
string $column
string $except
string $idColumn
public url():Contracts

The field under validation must be a valid URL according to PHP's filter_var function.

public sometimes():Contracts

In some situations, you may wish to run validation checks against a field only if that field is present in the input array. To quickly accomplish this, add the sometimes rule.

public nullable():Contracts

The field under validation may be null. This is particularly useful when validating primitive such as strings and integers that can contain null values.

public validBoardTaskReferenceValue():Contracts

The field under validation must be a valid board task reference type (e.g. {@link BoardTaskReferenceType::CONTACT}).

Service

AttributeFactory

Instantiates Attribute Classes

Namespace

Plenty\Validation\Service

Methods

public create(string $which):Attribute
Parameters
string $which

ValidatorFactory

Instantiates Validator Classes

Namespace

Plenty\Validation\Service

Methods

public create(string $validatorClass):Validator
Parameters
string $validatorClass The fully qualified classname of the validator to create (including namespace)

Illuminate

Support

MessageBag

Namespace

Illuminate\Support

Methods

public keys():array

Get the keys present in the message bag.

public add(string $key, string $message):Support

Add a message to the message bag.

Parameters
string $key
string $message
public merge($messages):Support

Merge a new array of messages into the message bag.

Parameters
$messages
public has($key):bool

Determine if messages exist for all of the given keys.

Parameters
$key
public hasAny($keys = []):bool

Determine if messages exist for any of the given keys.

Parameters
$keys
public first(string $key = null, string $format = null):string

Get the first message from the message bag for a given key.

Parameters
string $key
string $format
public get(string $key, string $format = null):array

Get all of the messages from the message bag for a given key.

Parameters
string $key
string $format
public all(string $format = null):array

Get all of the messages for every key in the message bag.

Parameters
string $format
public unique(string $format = null):array

Get all of the unique messages for every key in the message bag.

Parameters
string $format
public messages():array

Get the raw messages in the message bag.

public getMessages():array

Get the raw messages in the message bag.

public getMessageBag():MessageBag

Get the messages for the instance.

public getFormat():string

Get the default message format.

public setFormat(string $format = ":message"):MessageBag

Set the default message format.

Parameters
string $format
public isEmpty():bool

Determine if the message bag has any messages.

public isNotEmpty():bool

Determine if the message bag has any messages.

public any():bool

Determine if the message bag has any messages.

public count():int

Get the number of messages in the message bag.

public toArray():array

Get the instance as an array.

public jsonSerialize():array

Convert the object into something JSON serializable.

public toJson(int $options):string

Convert the object to its JSON representation.

Parameters
int $options

Collection

Namespace

Illuminate\Support

Methods

public static times(int $number, callable $callback = null):Support

Create a new collection by invoking the callback a given amount of times.

Parameters
int $number
callable $callback
public all():array

Get all of the items in the collection.

public avg($callback = null):void

Get the average value of a given key.

Parameters
$callback
public mode($key = null):array

Get the mode of a given key.

Parameters
$key
public collapse():Support

Collapse the collection of items into a single array.

public contains($key, $operator = null, $value = null):bool

Determine if an item exists in the collection.

Parameters
$key
$operator
$value
public crossJoin($lists):Support

Cross join with the given lists, returning all possible permutations.

Parameters
$lists
public diff($items):Support

Get the items in the collection that are not present in the given items.

Parameters
$items
public diffAssoc($items):Support

Get the items in the collection whose keys and values are not present in the given items.

Parameters
$items
public diffKeys($items):Support

Get the items in the collection whose keys are not present in the given items.

Parameters
$items
public except($keys):Support

Get all items except for those with the specified keys.

Parameters
$keys
public filter(callable $callback = null):Support

Run a filter over each of the items.

Parameters
callable $callback
public first(callable $callback = null, $default = null):void

Get the first item from the collection passing the given truth test.

Parameters
callable $callback
$default
public flip():Support

Flip the items in the collection.

public forget($keys):Support

Remove an item from the collection by key.

Parameters
$keys
public get($key, $default = null):void

Get an item from the collection by key.

Parameters
$key
$default
public groupBy($groupBy, bool $preserveKeys = false):Support

Group an associative array by a field or using a callback.

Parameters
$groupBy
bool $preserveKeys
public keyBy($keyBy):Support

Key an associative array by a field or using a callback.

Parameters
$keyBy
public has($key):bool

Determine if an item exists in the collection by key.

Parameters
$key
public implode(string $value, string $glue = null):string

Concatenate values of a given key as a string.

Parameters
string $value
string $glue
public intersect($items):Support

Intersect the collection with the given items.

Parameters
$items
public intersectByKeys($items):Support

Intersect the collection with the given items by key.

Parameters
$items
public isEmpty():bool

Determine if the collection is empty or not.

public keys():Support

Get the keys of the collection items.

public last(callable $callback = null, $default = null):void

Get the last item from the collection.

Parameters
callable $callback
$default
public pluck($value, string $key = null):Support

Get the values of a given key.

Parameters
$value
string $key
public map(callable $callback):Support

Run a map over each of the items.

Parameters
callable $callback
public mapToDictionary(callable $callback):Support

Run a dictionary map over the items.

Parameters
callable $callback
public mapWithKeys(callable $callback):Support

Run an associative map over each of the items.

Parameters
callable $callback
public merge($items):Support

Merge the collection with the given items.

Parameters
$items
public combine($values):Support

Create a collection by using this collection for keys and another for its values.

Parameters
$values
public union($items):Support

Union the collection with the given items.

Parameters
$items
public nth(int $step, int $offset):Support

Create a new collection consisting of every n-th element.

Parameters
int $step
int $offset
public only($keys):Support

Get the items with the specified keys.

Parameters
$keys
public pop():void

Get and remove the last item from the collection.

public prepend($value, $key = null):Support

Push an item onto the beginning of the collection.

Parameters
$value
$key
public push($value):Support

Push an item onto the end of the collection.

Parameters
$value
public pull($key, $default = null):void

Get and remove an item from the collection.

Parameters
$key
$default
public put($key, $value):Support

Put an item in the collection by key.

Parameters
$key
$value
public random(int $number = null):void

Get one or a specified number of items randomly from the collection.

Parameters
int $number
public reduce(callable $callback, $initial = null):void

Reduce the collection to a single value.

Parameters
callable $callback
$initial
public reverse():Support

Reverse items order.

public search($value, bool $strict = false):void

Search the collection for a given value and return the corresponding key if successful.

Parameters
$value
bool $strict
public shift():void

Get and remove the first item from the collection.

public shuffle(int $seed = null):Support

Shuffle the items in the collection.

Parameters
int $seed
public slice(int $offset, int $length = null):Support

Slice the underlying collection array.

Parameters
int $offset
int $length
public split(int $numberOfGroups):Support

Split a collection into a certain number of groups.

Parameters
int $numberOfGroups
public chunk(int $size):Support

Chunk the collection into chunks of the given size.

Parameters
int $size
public sort(callable $callback = null):Support

Sort through each item with a callback.

Parameters
callable $callback
public splice(int $offset, int $length = null, $replacement = []):Support

Splice a portion of the underlying collection array.

Parameters
int $offset
int $length
$replacement
public take(int $limit):Support

Take the first or last {$limit} items.

Parameters
int $limit
public transform(callable $callback):Support

Transform each item in the collection using a callback.

Parameters
callable $callback
public values():Support

Reset the keys on the underlying array.

public zip($items):Support

Zip the collection together with one or more arrays.

Parameters
$items
public pad(int $size, $value):Support

Pad collection to the specified length with a value.

Parameters
int $size
$value
public count():int

Count the number of items in the collection.

public offsetExists($key):bool

Determine if an item exists at an offset.

Parameters
$key
public offsetGet($key):void

Get an item at a given offset.

Parameters
$key
public offsetSet($key, $value):void

Set the item at a given offset.

Parameters
$key
$value
public offsetUnset(string $key):void

Unset the item at a given offset.

Parameters
string $key
public static make($items = []):Support

Create a new collection instance if the value isn't one already.

Parameters
$items
public static wrap($value):Support

Wrap the given value in a collection if applicable.

Parameters
$value
public static unwrap($value):array

Get the underlying items from the given collection if applicable.

Parameters
$value
public average($callback = null):void

Alias for the "avg" method.

Parameters
$callback
public containsStrict($key, $value = null):bool

Determine if an item exists, using strict comparison.

Parameters
$key
$value
public each(callable $callback):Support

Execute a callback over each item.

Parameters
callable $callback
public eachSpread(callable $callback):Support

Execute a callback over each nested chunk of items.

Parameters
callable $callback
public every($key, $operator = null, $value = null):bool

Determine if all items pass the given truth test.

Parameters
$key
$operator
$value
public firstWhere(string $key, $operator = null, $value = null):void

Get the first item by the given key value pair.

Parameters
string $key
$operator
$value
public isNotEmpty():bool

Determine if the collection is not empty.

public mapSpread(callable $callback):Support

Run a map over each nested chunk of items.

Parameters
callable $callback
public mapToGroups(callable $callback):Support

Run a grouping map over the items.

Parameters
callable $callback
public flatMap(callable $callback):Support

Map a collection and flatten the result by a single level.

Parameters
callable $callback
public mapInto(string $class):Support

Map the values into a new class.

Parameters
string $class
public min($callback = null):void

Get the min value of a given key.

Parameters
$callback
public max($callback = null):void

Get the max value of a given key.

Parameters
$callback
public forPage(int $page, int $perPage):Support

"Paginate" the collection by slicing it into a smaller collection.

Parameters
int $page
int $perPage
public partition($key, $operator = null, $value = null):Support

Partition the collection into two arrays using the given callback or key.

Parameters
$key
$operator
$value
public sum($callback = null):void

Get the sum of the given values.

Parameters
$callback
public when($value, callable $callback, callable $default = null):void

Apply the callback if the value is truthy.

Parameters
$value
callable $callback
callable $default
public unless(bool $value, callable $callback, callable $default = null):void

Apply the callback if the value is falsy.

Parameters
bool $value
callable $callback
callable $default
public where(string $key, $operator = null, $value = null):Support

Filter items by the given key value pair.

Parameters
string $key
$operator
$value
public whereStrict(string $key, $value):Support

Filter items by the given key value pair using strict comparison.

Parameters
string $key
$value
public whereIn(string $key, $values, bool $strict = false):Support

Filter items by the given key value pair.

Parameters
string $key
$values
bool $strict
public whereInStrict(string $key, $values):Support

Filter items by the given key value pair using strict comparison.

Parameters
string $key
$values
public whereNotIn(string $key, $values, bool $strict = false):Support

Filter items by the given key value pair.

Parameters
string $key
$values
bool $strict
public whereNotInStrict(string $key, $values):Support

Filter items by the given key value pair using strict comparison.

Parameters
string $key
$values
public pipe(callable $callback):void

Pass the collection to the given callback and return the result.

Parameters
callable $callback
public tap(callable $callback):Support

Pass the collection to the given callback and then return it.

Parameters
callable $callback
public reject($callback = true):Support

Create a collection of all elements that do not pass a given truth test.

Parameters
$callback
public unique($key = null, bool $strict = false):Support

Return only unique items from the collection array.

Parameters
$key
bool $strict
public uniqueStrict($key = null):Support

Return only unique items from the collection array using strict comparison.

Parameters
$key
public toArray():array

Get the collection of items as a plain array.

public jsonSerialize():array

Convert the object into something JSON serializable.

public toJson(int $options):string

Get the collection of items as JSON.

Parameters
int $options
public static proxy(string $method):void

Add a method to the list of proxied methods.

Parameters
string $method
public static macro(string $name, $macro):void

Register a custom macro.

Parameters
string $name
$macro
public static hasMacro(string $name):bool

Checks if macro is registered.

Parameters
string $name

ServiceProvider

Namespace

Illuminate\Support

Carbon

Carbon

Namespace

Carbon

Properties

Type Name Description
year
yearIso
month
day
hour
minute
second
micro
microsecond
timestamp
englishDayOfWeek
shortEnglishDayOfWeek
englishMonth
shortEnglishMonth
localeDayOfWeek
shortLocaleDayOfWeek
localeMonth
shortLocaleMonth
milliseconds
millisecond
milli
week
isoWeek
weekYear
isoWeekYear
dayOfYear
age
offset
offsetMinutes
offsetHours
timezone
tz

Methods

public copy():Carbon

Get a copy of the instance.

public nowWithSameTz():Carbon

Returns a present instance in the same timezone.

public setDateTime(int $year, int $month, int $day, int $hour, int $minute, int $second, int $microseconds):Carbon

Set the date and time all together.

Parameters
int $year
int $month
int $day
int $hour
int $minute
int $second
int $microseconds
public setTimeFromTimeString(string $time):Carbon

Set the time by time string.

Parameters
string $time
public timezone($value):Carbon
Parameters
$value
public tz($value = null):void

Set the timezone or returns the timezone name if no arguments passed.

Parameters
$value
public setDateFrom($date = null):Carbon

Set the year, month, and date for this instance to that of the passed instance.

Parameters
$date now if null
public setTimeFrom($date = null):Carbon

Set the hour, minute, second and microseconds for this instance to that of the passed instance.

Parameters
$date now if null
public static getDays():array

Get the days of the week

public static getWeekStartsAt():int

Get the first day of week

public static setWeekStartsAt($day):void
Parameters
$day week start day (or 'auto' to get the first day of week from Carbon::getLocale() culture).
public static getWeekEndsAt():int

Get the last day of week

public static setWeekEndsAt($day):void
Parameters
$day week end day (or 'auto' to get the day before the first day of week from Carbon::getLocale() culture).
public static getWeekendDays():array

Get weekend days

public static setWeekendDays(array $days):void
Parameters
array $days
public static hasRelativeKeywords(string $time):bool

Determine if a time string will produce a relative date.

Parameters
string $time
public static setUtf8(bool $utf8):void
Parameters
bool $utf8
public formatLocalized(string $format):string

Format the instance with the current locale. You can set the current locale using setlocale() http://php.net/setlocale.

Parameters
string $format
public startOfDay():Carbon

Resets the time to 00:00:00 start of day

public endOfDay():Carbon

Resets the time to 23:59:59.999999 end of day

public startOfMonth():Carbon

Resets the date to the first day of the month and the time to 00:00:00

public endOfMonth():Carbon

Resets the date to end of the month and time to 23:59:59.999999

public startOfQuarter():Carbon

Resets the date to the first day of the quarter and the time to 00:00:00

public endOfQuarter():Carbon

Resets the date to end of the quarter and time to 23:59:59.999999

public startOfYear():Carbon

Resets the date to the first day of the year and the time to 00:00:00

public endOfYear():Carbon

Resets the date to end of the year and time to 23:59:59.999999

public startOfDecade():Carbon

Resets the date to the first day of the decade and the time to 00:00:00

public endOfDecade():Carbon

Resets the date to end of the decade and time to 23:59:59.999999

public startOfCentury():Carbon

Resets the date to the first day of the century and the time to 00:00:00

public endOfCentury():Carbon

Resets the date to end of the century and time to 23:59:59.999999

public startOfWeek(int $weekStartsAt = null):Carbon

Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00

Parameters
int $weekStartsAt optional start allow you to specify the day of week to use to start the week
public endOfWeek(int $weekEndsAt = null):Carbon

Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59.999999

Parameters
int $weekEndsAt optional start allow you to specify the day of week to use to end the week
public startOfHour():Carbon

Modify to start of current hour, minutes and seconds become 0

public endOfHour():Carbon

Modify to end of current hour, minutes and seconds become 59

public startOfMinute():Carbon

Modify to start of current minute, seconds become 0

public endOfMinute():Carbon

Modify to end of current minute, seconds become 59

public eq($date):bool

Determines if the instance is equal to another

Parameters
$date
public equalTo($date):bool

Determines if the instance is equal to another

Parameters
$date
public ne($date):bool

Determines if the instance is not equal to another

Parameters
$date
public notEqualTo($date):bool

Determines if the instance is not equal to another

Parameters
$date
public gt($date):bool

Determines if the instance is greater (after) than another

Parameters
$date
public greaterThan($date):bool

Determines if the instance is greater (after) than another

Parameters
$date
public gte($date):bool

Determines if the instance is greater (after) than or equal to another

Parameters
$date
public greaterThanOrEqualTo($date):bool

Determines if the instance is greater (after) than or equal to another

Parameters
$date
public lt($date):bool

Determines if the instance is less (before) than another

Parameters
$date
public lessThan($date):bool

Determines if the instance is less (before) than another

Parameters
$date
public lte($date):bool

Determines if the instance is less (before) or equal to another

Parameters
$date
public lessThanOrEqualTo($date):bool

Determines if the instance is less (before) or equal to another

Parameters
$date
public between($date1, $date2, bool $equal = true):bool

Determines if the instance is between two others.

Parameters
$date1
$date2
bool $equal Indicates if an equal to comparison should be done
public isWeekday():bool

Determines if the instance is a weekday.

public isWeekend():bool

Determines if the instance is a weekend day.

public isYesterday():bool

Determines if the instance is yesterday.

public isToday():bool

Determines if the instance is today.

public isTomorrow():bool

Determines if the instance is tomorrow.

public isFuture():bool

Determines if the instance is in the future, ie. greater (after) than now.

public isPast():bool

Determines if the instance is in the past, ie. less (before) than now.

public isLeapYear():bool

Determines if the instance is a leap year.

public isLongYear():bool

Determines if the instance is a long year

public isSameAs(string $format, $date = null):bool

Compares the formatted values of the two dates.

Parameters
string $format date formats to compare.
$date instance to compare with or null to use current day.
public isSameQuarter($date = null, bool $ofSameYear = true):bool

Checks if the passed in date is in the same quarter as the instance quarter (and year if needed).

Parameters
$date The instance to compare with or null to use current day.
bool $ofSameYear Check if it is the same month in the same year.
public isSameMonth($date = null, bool $ofSameYear = true):bool

Checks if the passed in date is in the same month as the instance´s month.

Parameters
$date The instance to compare with or null to use the current date.
bool $ofSameYear Check if it is the same month in the same year.
public isDayOfWeek(int $dayOfWeek):bool

Checks if this day is a specific day of the week.

Parameters
int $dayOfWeek
public isBirthday($date = null):bool

Check if its the birthday. Compares the date/month values of the two dates.

Parameters
$date The instance to compare with or null to use current day.
public isLastOfMonth():bool

Check if today is the last day of the Month

public static hasFormat(string $date, string $format):bool

Checks if the (date)time string is in a given format.

Parameters
string $date
string $format
public static resetToStringFormat():void

Reset the format used to the default when type juggling a Carbon instance to a string

public static setToStringFormat($format):void
Parameters
$format
public toDateString():string

Format the instance as date

public toFormattedDateString():string

Format the instance as a readable date

public toTimeString(string $unitPrecision = "second"):string

Format the instance as time

Parameters
string $unitPrecision
public toDateTimeString(string $unitPrecision = "second"):string

Format the instance as date and time

Parameters
string $unitPrecision
public toDayDateTimeString():string

Format the instance with day, date and time

public toAtomString():string

Format the instance as ATOM

public toCookieString():string

Format the instance as COOKIE

public toIso8601String():string

Format the instance as ISO8601

public toRfc822String():string

Format the instance as RFC822

public toIso8601ZuluString(string $unitPrecision = "second"):string

Convert the instance to UTC and return as Zulu ISO8601

Parameters
string $unitPrecision
public toRfc850String():string

Format the instance as RFC850

public toRfc1036String():string

Format the instance as RFC1036

public toRfc1123String():string

Format the instance as RFC1123

public toRfc2822String():string

Format the instance as RFC2822

public toRfc3339String():string

Format the instance as RFC3339

public toRssString():string

Format the instance as RSS

public toW3cString():string

Format the instance as W3C

public toRfc7231String():string

Format the instance as RFC7231

public toArray():array

Get default array representation.

public static instance(DateTimeInterface
 $date):Carbon

Create a Carbon instance from a DateTime one.

Parameters
DateTimeInterface $date
public static parse(string $time = null, $tz = null):Carbon

Create a carbon instance from a string.

Parameters
string $time
$tz
public static now($tz = null):Carbon

Get a Carbon instance for the current date and time.

Parameters
$tz
public static today($tz = null):Carbon

Create a Carbon instance for today.

Parameters
$tz
public static tomorrow($tz = null):Carbon

Create a Carbon instance for tomorrow.

Parameters
$tz
public static yesterday($tz = null):Carbon

Create a Carbon instance for yesterday.

Parameters
$tz
public static maxValue():Carbon

Create a Carbon instance for the greatest supported date.

public static minValue():Carbon

Create a Carbon instance for the lowest supported date.

public static create(int $year, int $month = 1, int $day = 1, int $hour, int $minute, int $second, $tz = null):Carbon

Create a new Carbon instance from a specific date and time.

Parameters
int $year
int $month
int $day
int $hour
int $minute
int $second
$tz
public static createSafe(int $year = null, int $month = null, int $day = null, int $hour = null, int $minute = null, int $second = null, $tz = null):void

Create a new safe Carbon instance from a specific date and time.

Parameters
int $year
int $month
int $day
int $hour
int $minute
int $second
$tz
public static createFromDate(int $year = null, int $month = null, int $day = null, $tz = null):Carbon

Create a Carbon instance from just a date. The time portion is set to now.

Parameters
int $year
int $month
int $day
$tz
public static createMidnightDate(int $year = null, int $month = null, int $day = null, $tz = null):Carbon

Create a Carbon instance from just a date. The time portion is set to midnight.

Parameters
int $year
int $month
int $day
$tz
public static createFromTime(int $hour, int $minute, int $second, $tz = null):Carbon

Create a Carbon instance from just a time. The date portion is set to today.

Parameters
int $hour
int $minute
int $second
$tz
public static createFromTimeString(string $time, $tz = null):Carbon

Create a Carbon instance from a time string. The date portion is set to today.

Parameters
string $time
$tz
public diffInYears($date = null, bool $absolute = true):int

Get the difference in years

Parameters
$date
bool $absolute Get the absolute of the difference
public diffInMonths($date = null, bool $absolute = true):int

Get the difference in months rounded down.

Parameters
$date
bool $absolute Get the absolute of the difference
public diffInWeeks($date = null, bool $absolute = true):int

Get the difference in weeks rounded down.

Parameters
$date
bool $absolute Get the absolute of the difference
public diffInDays($date = null, bool $absolute = true):int

Get the difference in days rounded down.

Parameters
$date
bool $absolute Get the absolute of the difference
public diffInWeekdays($date = null, bool $absolute = true):int

Get the difference in weekdays rounded down.

Parameters
$date
bool $absolute Get the absolute of the difference
public diffInWeekendDays($date = null, bool $absolute = true):int

Get the difference in weekend days using a filter rounded down.

Parameters
$date
bool $absolute Get the absolute of the difference
public diffInHours($date = null, bool $absolute = true):int

Get the difference in hours rounded down.

Parameters
$date
bool $absolute Get the absolute of the difference
public diffInRealHours($date = null, bool $absolute = true):int

Get the difference in hours rounded down using timestamps.

Parameters
$date
bool $absolute Get the absolute of the difference
public diffInMinutes($date = null, bool $absolute = true):int

Get the difference in minutes rounded down.

Parameters
$date
bool $absolute Get the absolute of the difference
public diffInRealMinutes($date = null, bool $absolute = true):int

Get the difference in minutes rounded down using timestamps.

Parameters
$date
bool $absolute Get the absolute of the difference
public diffInSeconds($date = null, bool $absolute = true):int

Get the difference in seconds rounded down.

Parameters
$date
bool $absolute Get the absolute of the difference
public diffInRealSeconds($date = null, bool $absolute = true):int

Get the difference in seconds using timestamps.

Parameters
$date
bool $absolute Get the absolute of the difference
public secondsSinceMidnight():int

The number of seconds since midnight.

public secondsUntilEndOfDay():int

The number of seconds until 23:59:59.

public diffForHumans($other = null, $syntax = null, bool $short = false, int $parts = 1, int $options = null):string

Get the difference in a human readable format in the current locale from current instance to an other instance given (or now if null given).

Parameters
$other if array passed, will be used as parameters array, see $syntax below; if null passed, now will be used as comparison reference; if any other type, it will be converted to date and used as reference.
$syntax if array passed, parameters will be extracted from it, the array may contains: - 'syntax' entry (see below) - 'short' entry (see below) - 'parts' entry (see below) - 'options' entry (see below) - 'join' entry determines how to join multiple parts of the string ` - if $join is a string, it's used as a joiner glue ` - if $join is a callable/closure, it get the list of string and should return a string ` - if $join is an array, the first item will be the default glue, and the second item ` will be used instead of the glue for the last item ` - if $join is true, it will be guessed from the locale ('list' translation file entry) ` - if $join is missing, a space will be used as glue - 'other' entry (see above) if int passed, it add modifiers: Possible values: - CarbonInterface::DIFF_ABSOLUTE no modifiers - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier Default value: CarbonInterface::DIFF_ABSOLUTE
bool $short displays short format of time units
int $parts maximum number of parts to display (default value: 1: single unit)
int $options human diff options
public static macro(string $name, $macro):void

Register a custom macro.

Parameters
string $name
$macro
public static hasMacro(string $name):bool

Checks if macro is registered globally.

Parameters
string $name
public static getMidDayAt():int

get midday/noon hour

public static setMidDayAt(int $hour):void
Parameters
int $hour midday hour
public midDay():Carbon

Modify to midday, default to self::$midDayAt

public next($modifier = null):Carbon

Modify to the next occurrence of a given modifier such as a day of the week. If no modifier is provided, modify to the next occurrence of the current day of the week. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters
$modifier
public nextWeekday():Carbon

Go forward to the next weekday.

public previousWeekday():Carbon

Go backward to the previous weekday.

public nextWeekendDay():Carbon

Go forward to the next weekend day.

public previousWeekendDay():Carbon

Go backward to the previous weekend day.

public previous($modifier = null):Carbon

Modify to the previous occurrence of a given modifier such as a day of the week. If no dayOfWeek is provided, modify to the previous occurrence of the current day of the week. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters
$modifier
public firstOfMonth(int $dayOfWeek = null):Carbon

Modify to the first occurrence of a given day of the week in the current month. If no dayOfWeek is provided, modify to the first day of the current month. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters
int $dayOfWeek
public lastOfMonth(int $dayOfWeek = null):Carbon

Modify to the last occurrence of a given day of the week in the current month. If no dayOfWeek is provided, modify to the last day of the current month. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters
int $dayOfWeek
public nthOfMonth(int $nth, int $dayOfWeek):void

Modify to the given occurrence of a given day of the week in the current month. If the calculated occurrence is outside the scope of the current month, then return false and no modifications are made.

Parameters
int $nth
int $dayOfWeek
public firstOfQuarter(int $dayOfWeek = null):Carbon

Modify to the first occurrence of a given day of the week in the current quarter. If no dayOfWeek is provided, modify to the first day of the current quarter. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters
int $dayOfWeek day of the week default null
public lastOfQuarter(int $dayOfWeek = null):Carbon

Modify to the last occurrence of a given day of the week in the current quarter. If no dayOfWeek is provided, modify to the last day of the current quarter. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters
int $dayOfWeek day of the week default null
public nthOfQuarter(int $nth, int $dayOfWeek):void

Modify to the given occurrence of a given day of the week in the current quarter. If the calculated occurrence is outside the scope of the current quarter, then return false and no modifications are made.

Parameters
int $nth
int $dayOfWeek
public firstOfYear(int $dayOfWeek = null):Carbon

Modify to the first occurrence of a given day of the week in the current year. If no dayOfWeek is provided, modify to the first day of the current year. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters
int $dayOfWeek day of the week default null
public lastOfYear(int $dayOfWeek = null):Carbon

Modify to the last occurrence of a given day of the week in the current year. If no dayOfWeek is provided, modify to the last day of the current year. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters
int $dayOfWeek day of the week default null
public nthOfYear(int $nth, int $dayOfWeek):void

Modify to the given occurrence of a given day of the week in the current year. If the calculated occurrence is outside the scope of the current year, then return false and no modifications are made.

Parameters
int $nth
int $dayOfWeek
public average($date = null):Carbon

Modify the current instance to the average of a given instance (default now) and the current instance (second-precision).

Parameters
$date
public closest($date1, $date2):Carbon

Get the closest date from the instance (second-precision).

Parameters
$date1
$date2
public farthest($date1, $date2):Carbon

Get the farthest date from the instance (second-precision).

Parameters
$date1
$date2
public min($date = null):Carbon

Get the minimum instance between a given instance (default now) and the current instance.

Parameters
$date
public minimum($date = null):Carbon

Get the minimum instance between a given instance (default now) and the current instance.

Parameters
$date
public max($date = null):Carbon

Get the maximum instance between a given instance (default now) and the current instance.

Parameters
$date
public maximum($date = null):Carbon

Get the maximum instance between a given instance (default now) and the current instance.

Parameters
$date
public static useMonthsOverflow(bool $monthsOverflow = true):void
Parameters
bool $monthsOverflow
public static resetMonthsOverflow():void
public static shouldOverflowMonths():bool

Get the month overflow global behavior (can be overridden in specific instances).

public static useYearsOverflow(bool $yearsOverflow = true):void
Parameters
bool $yearsOverflow
public static resetYearsOverflow():void
public static shouldOverflowYears():bool

Get the month overflow global behavior (can be overridden in specific instances).

public static setHumanDiffOptions(int $humanDiffOptions):void
Parameters
int $humanDiffOptions
public static enableHumanDiffOption(int $humanDiffOption):void
Parameters
int $humanDiffOption
public static disableHumanDiffOption(int $humanDiffOption):void
Parameters
int $humanDiffOption
public static getHumanDiffOptions():int

Return default humanDiff() options (merged flags as integer).

public serialize():string

Return a serialized string of the instance.

public static fromSerialized(string $value):Carbon

Create an instance from a serialized string.

Parameters
string $value
public jsonSerialize():void

Prepare the object for JSON serialization.

public static serializeUsing(callable $callback):void
Parameters
callable $callback
public static createFromTimestamp(int $timestamp, $tz = null):Carbon

Create a Carbon instance from a timestamp.

Parameters
int $timestamp
$tz
public static createFromTimestampMs(float $timestamp, $tz = null):Carbon

Create a Carbon instance from a timestamp in milliseconds.

Parameters
float $timestamp
$tz
public static createFromTimestampUTC(int $timestamp):Carbon

Create a Carbon instance from an UTC timestamp.

Parameters
int $timestamp
public timestamp(int $value):Carbon

Set the instance's timestamp.

Parameters
int $value
public isSunday():bool

Checks if the instance day is sunday.

public isMonday():bool

Checks if the instance day is monday.

public isTuesday():bool

Checks if the instance day is tuesday.

public isWednesday():bool

Checks if the instance day is wednesday.

public isThursday():bool

Checks if the instance day is thursday.

public isFriday():bool

Checks if the instance day is friday.

public isSaturday():bool

Checks if the instance day is saturday.

public isSameYear($date = null):bool

Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null
public isCurrentYear():bool

Checks if the instance is in the same year as the current moment.

public isNextYear():bool

Checks if the instance is in the same year as the current moment next year.

public isLastYear():bool

Checks if the instance is in the same year as the current moment last year.

public isNextWeek():bool

Checks if the instance is in the same week as the current moment next week.

public isLastWeek():bool

Checks if the instance is in the same week as the current moment last week.

public isSameDay($date = null):bool

Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone).

Parameters
$date = null
public isCurrentMonth():bool

Checks if the instance is in the same month as the current moment.

public isNextMonth():bool

Checks if the instance is in the same month as the current moment next month.

public isLastMonth():bool

Checks if the instance is in the same month as the current moment last month.

public isCurrentQuarter():bool

Checks if the instance is in the same quarter as the current moment.

public isNextQuarter():bool

Checks if the instance is in the same quarter as the current moment next quarter.

public isLastQuarter():bool

Checks if the instance is in the same quarter as the current moment last quarter.

public year(int $value):Carbon

Set current instance year to the given value.

Parameters
int $value
public month(int $value):Carbon

Set current instance month to the given value.

Parameters
int $value
public day(int $value):Carbon

Set current instance day to the given value.

Parameters
int $value
public hour(int $value):Carbon

Set current instance hour to the given value.

Parameters
int $value
public minute(int $value):Carbon

Set current instance minute to the given value.

Parameters
int $value
public second(int $value):Carbon

Set current instance second to the given value.

Parameters
int $value
public addYears(int $value = 1):Carbon

Add years (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public addYear():Carbon

Add one year to the instance (using date interval).

public subYears(int $value = 1):Carbon

Sub years (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public subYear():Carbon

Sub one year to the instance (using date interval).

public addYearsWithOverflow(int $value = 1):Carbon

Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
int $value = 1
public addYearWithOverflow():Carbon

Add one year to the instance (using date interval) with overflow explicitly allowed.

public subYearsWithOverflow(int $value = 1):Carbon

Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
int $value = 1
public subYearWithOverflow():Carbon

Sub one year to the instance (using date interval) with overflow explicitly allowed.

public addYearsNoOverflow(int $value = 1):Carbon

Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
int $value = 1
public addYearNoOverflow():Carbon

Add one year to the instance (using date interval) with overflow explicitly forbidden.

public subYearsNoOverflow(int $value = 1):Carbon

Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
int $value = 1
public subYearNoOverflow():Carbon

Sub one year to the instance (using date interval) with overflow explicitly forbidden.

public addMonths(int $value = 1):Carbon

Add months (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public addMonth():Carbon

Add one month to the instance (using date interval).

public subMonths(int $value = 1):Carbon

Sub months (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public subMonth():Carbon

Sub one month to the instance (using date interval).

public addMonthsWithOverflow(int $value = 1):Carbon

Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
int $value = 1
public addMonthWithOverflow():Carbon

Add one month to the instance (using date interval) with overflow explicitly allowed.

public subMonthsWithOverflow(int $value = 1):Carbon

Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed.

Parameters
int $value = 1
public subMonthWithOverflow():Carbon

Sub one month to the instance (using date interval) with overflow explicitly allowed.

public addMonthsNoOverflow(int $value = 1):Carbon

Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
int $value = 1
public addMonthNoOverflow():Carbon

Add one month to the instance (using date interval) with overflow explicitly forbidden.

public subMonthsNoOverflow(int $value = 1):Carbon

Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden.

Parameters
int $value = 1
public subMonthNoOverflow():Carbon

Sub one month to the instance (using date interval) with overflow explicitly forbidden.

public addDays(int $value = 1):Carbon

Add days (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public addDay():Carbon

Add one day to the instance (using date interval).

public subDays(int $value = 1):Carbon

Sub days (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public subDay():Carbon

Sub one day to the instance (using date interval).

public addHours(int $value = 1):Carbon

Add hours (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public addHour():Carbon

Add one hour to the instance (using date interval).

public subHours(int $value = 1):Carbon

Sub hours (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public subHour():Carbon

Sub one hour to the instance (using date interval).

public addMinutes(int $value = 1):Carbon

Add minutes (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public addMinute():Carbon

Add one minute to the instance (using date interval).

public subMinutes(int $value = 1):Carbon

Sub minutes (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public subMinute():Carbon

Sub one minute to the instance (using date interval).

public addSeconds(int $value = 1):Carbon

Add seconds (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public addSecond():Carbon

Add one second to the instance (using date interval).

public subSeconds(int $value = 1):Carbon

Sub seconds (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public subSecond():Carbon

Sub one second to the instance (using date interval).

public addCenturies(int $value = 1):Carbon

Add centuries (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public addCentury():Carbon

Add one century to the instance (using date interval).

public subCenturies(int $value = 1):Carbon

Sub centuries (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public subCentury():Carbon

Sub one century to the instance (using date interval).

public addQuarters(int $value = 1):Carbon

Add quarters (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public addQuarter():Carbon

Add one quarter to the instance (using date interval).

public subQuarters(int $value = 1):Carbon

Sub quarters (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public subQuarter():Carbon

Sub one quarter to the instance (using date interval).

public addWeeks(int $value = 1):Carbon

Add weeks (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public addWeek():Carbon

Add one week to the instance (using date interval).

public subWeeks(int $value = 1):Carbon

Sub weeks (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public subWeek():Carbon

Sub one week to the instance (using date interval).

public addWeekdays(int $value = 1):Carbon

Add weekdays (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public addWeekday():Carbon

Add one weekday to the instance (using date interval).

public subWeekdays(int $value = 1):Carbon

Sub weekdays (the $value count passed in) to the instance (using date interval).

Parameters
int $value = 1
public subWeekday():Carbon

Sub one weekday to the instance (using date interval).

public addRealSeconds(int $value = 1):Carbon

Add seconds (the $value count passed in) to the instance (using timestamp).

Parameters
int $value = 1
public addRealSecond():Carbon

Add one second to the instance (using timestamp).

public subRealSeconds(int $value = 1):Carbon

Sub seconds (the $value count passed in) to the instance (using timestamp).

Parameters
int $value = 1
public subRealSecond():Carbon

Sub one second to the instance (using timestamp).

public addRealMinutes(int $value = 1):Carbon

Add minutes (the $value count passed in) to the instance (using timestamp).

Parameters
int $value = 1
public addRealMinute():Carbon

Add one minute to the instance (using timestamp).

public subRealMinutes(int $value = 1):Carbon

Sub minutes (the $value count passed in) to the instance (using timestamp).

Parameters
int $value = 1
public subRealMinute():Carbon

Sub one minute to the instance (using timestamp).

public addRealHours(int $value = 1):Carbon

Add hours (the $value count passed in) to the instance (using timestamp).

Parameters
int $value = 1
public addRealHour():Carbon

Add one hour to the instance (using timestamp).

public subRealHours(int $value = 1):Carbon

Sub hours (the $value count passed in) to the instance (using timestamp).

Parameters
int $value = 1
public subRealHour():Carbon

Sub one hour to the instance (using timestamp).

Database

Eloquent

Model

Abstract Model class

Namespace

Illuminate\Database\Eloquent

Collection

Namespace

Illuminate\Database\Eloquent

Component

HttpFoundation

Response

Namespace

Symfony\Component\HttpFoundation