Download the PHP package betobetok/ask-svg without Composer

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

FAQ

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

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

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

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

Informations about the package ask-svg

ASK - PHP Svg Manipulation

Tests

Code Style

Latest Stable Version

Total Downloads

A package to convert an svg graphic file into a Php object. based on Blade UIkit

by using the svg() function we can retrieve an svg file using the file name and convert it into an object of the Svg class and manipulate it as such.

svg file my_svg.svg


The Svg class

 Full name: \ASK\Svg\Svg

the Svg document

Class Svg implements:

Svg Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*style*|`Configurators\Style`||

Svg Methods

Class methods

Svg :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *fileName* | `string` | | | *contents* | `string` | | | *attributes* | `array` | | **returns** ---

Svg :: getStylefromContent

get the Style element from the string content **returns** ---

Svg :: removeStylefromContent

remove the string Style from the string content **returns** ---

Svg :: style

get the Style element **returns** ---

Svg :: setStyle

set the Style element | Parameter | Type | Description | |-----------|------|-------------| | *style* | `Configurators\Style` | | **returns** ---

Svg :: replaceClasses

replace the Classes names in the string content | Parameter | Type | Description | |-----------|------|-------------| | *style* | `Configurators\Style` | | | *content* | `string` | | **returns** ---

Svg :: mergeSvgs

merge one or more Svgs in this svg | Parameter | Type | Description | |-----------|------|-------------| | *param* | `Svg[]` | | **returns** ---

Svg :: toHtml

implements of Htmlable, toHtml return a string form of the svg in HTML format **returns** ---

Svg :: getAllSvgElements

get all the Svg elements in this svg, this array conteins all the elements in order | Parameter | Type | Description | |-----------|------|-------------| | *svg* | `mixed` | | **returns** ---

Svg :: cleanContent

cleanContent remove all string contents in the complet object **returns** ---

Svg :: getContent

Get the value of content (Conteiner implement) //TODO implementation of container **returns** ---

Svg :: setContent

Set the value of content (Conteiner implement) //TODO implementation of container | Parameter | Type | Description | |-----------|------|-------------| | *content* | `mixed` | | **returns** ---

Svg :: removeSvgAttribute

removes those attributes that belong exclusively to the svg element **returns** ---

Svg :: getOnlySvgAttribute

get those attributes that belong exclusively to the svg element **returns** ---


The SvgElement class

 Full name: \ASK\Svg\SvgElement

An element belonging to a svg structure

This object represents all the elements within an svg document

from the svg parent element to the internal elements or figures such as \<path\>, \<circle\> or \<g\>, passing through configuration elements such as \<style\>, \<defs\> among others

all elements are accessible in order through the attribute $elements, as well as through the array in the property with the name of the element

for example:

Class SvgElement implements:

SvgElement Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*name*|`string`|| ||*elements*|`SvgElement[]`|| ||*contents*|`string`|| ||*context*|`SvgElement`|| ||*transforms*|`Transformation`|| ||*isTransformable*|`bool`||

SvgElement Methods

Class methods

SvgElement :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *name* | `string` | | | *contents* | `string` | | | *attributes* | `array` | | | *context* | `SvgElement` | | **returns** ---

SvgElement :: makeTransformable

Make this element Transformable **returns** ---

SvgElement :: makeUntransformable

make this element Untransformable **returns** ---

SvgElement :: name

get or set the name of the element | Parameter | Type | Description | |-----------|------|-------------| | *arg* | `string` | | **returns** ---

SvgElement :: id

get or set the id attribute of the element in the attributes property | Parameter | Type | Description | |-----------|------|-------------| | *arg* | `string` | | **returns** ---

SvgElement :: transform

set or get the Transformation Object for the element | Parameter | Type | Description | |-----------|------|-------------| | *arg* | `mixed` | | **returns** ---

SvgElement :: contents

get the string contents of the elements - this method is similar at toHtml but get just the string of the content without the tag string **returns** ---

SvgElement :: removeContents

remove the string Contents property from the object **returns** ---

SvgElement :: setContents

set the string Contents property in the object | Parameter | Type | Description | |-----------|------|-------------| | *contents* | `string` | | **returns** ---

SvgElement :: getContext

get the property Context that is the parent SVG element of this element **returns** ---

SvgElement :: getAllElements

get all Elements from the string content this method make all found elements as SvgElement Objects and put in a property with the element name **returns** ---

SvgElement :: setElement

set a neu Element in this object | Parameter | Type | Description | |-----------|------|-------------| | *name* | `string` | | | *element* | `mixed` | | **returns** ---

SvgElement :: mergeAttributes

merge the attributes conteined in a string tag with the array attributes | Parameter | Type | Description | |-----------|------|-------------| | *tag* | `string` | | | *attributes* | `array` | | **returns** ---

SvgElement :: removeComents

remove coments from the string content **returns** ---

SvgElement :: toHtml

implements of Htmlable, toHtml return a string form of the svg element in HTML format **returns** ---

SvgElement :: removeId

remove the property Id **returns** ---

SvgElement :: toArray

toArray **returns** ---

SvgElement :: serialize

| Parameter | Type | Description | |-----------|------|-------------| | *data* | `mixed` | | **returns** ---

SvgElement :: unserialize

| Parameter | Type | Description | |-----------|------|-------------| | *data* | `mixed` | | **returns** ---

SvgElement :: findFirstGroupElement

find the first group element with the name $element and return the new corresponding SvgElement instance or null if not found | Parameter | Type | Description | |-----------|------|-------------| | *element* | `string` | | **returns** ---

SvgElement :: findFirstElement

return the first Element in the elements array or null if not found | Parameter | Type | Description | |-----------|------|-------------| | *elementName* | `string` | | **returns** ---

SvgElement :: findFirstNonGroupElement

find the first non-group element with the name $element and return the new corresponding SvgElement instance or null if not found | Parameter | Type | Description | |-----------|------|-------------| | *element* | `string` | | **returns** ---

SvgElement :: getElementAttributes

get the attributes of a element froma string tag () | Parameter | Type | Description | |-----------|------|-------------| | *tag* | `string` | | **returns** ---

SvgElement :: getTransformations

get the Transformations of the element and make the corresponding Transformation Object **returns** ---

SvgElement :: getElementById

find an element by its id and return it or null if not found | Parameter | Type | Description | |-----------|------|-------------| | *id* | `string` | | **returns** ---

SvgElement :: getStartPointById

get the start position point of an Shape element by its Id and return it or null if not found | Parameter | Type | Description | |-----------|------|-------------| | *id* | `string` | | **returns** ---

SvgElement :: hasContext

return true if the element has content or false otherwise **returns** ---


The abstract class Shape

 Full name: \ASK\Svg\Shapes\Shape

An element that make a Shape in a svg document

Shape Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*startPosition*|`\NumPHP\Core\NumArray`||

Shape Methods

Class methods

Shape :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *contents* | `string` | | | *attributes* | `array` | | | *context* | `SvgElement` | | **returns** ---

Shape :: getStartPosition

get the Start position o the element **returns** ---

Shape :: renderAttributes

renderAttributes return a string with attributes in a HTML format (overloaded Method from RenderAttributes) **returns** ---

Shape :: toHtml

(overloaded Method from SvgElement) **returns** ---

Class Circle

 Full name: \ASK\Svg\Shapes\Circle

A Circle element in a svg document

Class Circle inherits from class:


Circle Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*cx*|`float`|| ||*cy*|`float`|| ||*r*|`float`||

Methods

Class methods

Circle :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *contents* | `string` | | | *attributes* | `array` | | | *context* | `SvgElement` | | **returns** ---

Circle :: center

get the center of the circle **returns** ---

Circle :: diameter

get the Diameter of the circle **returns** ---

Circle :: radio

get the Radio of the circle **returns** ---

Circle :: area

get the Area of the circle **returns** ---

Class Ellipse

 Full name: \ASK\Svg\Shapes\Ellipse

A Ellipse element in a svg document

Class Ellipse inherits from class:


Ellipse Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*cx*|`float`|| ||*cy*|`float`|| ||*rx*|`float`|| ||*ry*|`float`||

Methods

Class methods

Ellipse :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *contents* | `string` | | | *attributes* | `array` | | | *context* | `SvgElement` | | **returns** ---

Ellipse :: center

get the Center of the ellipse **returns** ---

Ellipse :: radioX

get the x Radio of the ellipse **returns** ---

Ellipse :: radioY

get the y Radio of the ellipse **returns** ---

Ellipse :: area

get the Area of the ellipse **returns** ---

Class Line

 Full name: \ASK\Svg\Shapes\Line

A Line element in a svg document

Class Line inherits from class:


Line Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*x1*|`float`|| ||*y1*|`float`|| ||*x2*|`float`|| ||*y2*|`float`||

Methods

Class methods

Line :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *contents* | `string` | | | *attributes* | `array` | | | *context* | `SvgElement` | | **returns** ---

Line :: long

get teh Logitud of the line **returns** ---

Class Path

 Full name: \ASK\Svg\Shapes\Path

A Path element in a svg document

Class Path inherits from class:


Path Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*dString*|`string`|| ||*d*|`array`||

Methods

Class methods

Path :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *contents* | `string` | | | *attributes* | `array` | | | *context* | `SvgElement` | | **returns** ---

Path :: toHtml

(overloaded Method from SvgElement) **returns** ---

Path :: content

content get the content string of the svg elemnt to print in a HTML document **returns** ---

Path :: getExistingComands

getExistingComands get the existing comands in a d attribute from a string | Parameter | Type | Description | |-----------|------|-------------| | *d* | `string` | | **returns** ---

Path :: renderAttributes

renderAttributes return a string with attributes in a HTML format (overloaded Method from RenderAttributes) **returns** ---

Class Polygon

 Full name: \ASK\Svg\Shapes\Polygon

A Polygon element in a svg document

Class Polygon inherits from class:


Polygon Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*points*|`array`||

Methods

Class methods

Polygon :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *contents* | `string` | | | *attributes* | `array` | | | *context* | `SvgElement` | | **returns** ---

Polygon :: toHtml

(overloaded Method from SvgElement) **returns** ---

Polygon :: getPoints

get the array Points from a string | Parameter | Type | Description | |-----------|------|-------------| | *points* | `string` | | **returns** ---

Class Polyline

 Full name: \ASK\Svg\Shapes\Polyline

A Polyline element in a svg document

Class Polyline inherits from class:


Polyline Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*points*|`array`||

Methods

Class methods

Polyline :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *contents* | `string` | | | *attributes* | `array` | | | *context* | `SvgElement` | | **returns** ---

Polyline :: toHtml

(overloaded Method from SvgElement) **returns** ---

Polyline :: getPoints

get the array Points from a string | Parameter | Type | Description | |-----------|------|-------------| | *points* | `string` | | **returns** ---

Class Rect

 Full name: \ASK\Svg\Shapes\Rect

A Rect element in a svg document

Class Rect inherits from class:


Rect Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*x*|`float`|| ||*y*|`float`|| ||*width*|`float`|| ||*height*|`float`|| ||*rx*|`float`|| ||*ry*|`float`||

Methods

Class methods

Rect :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *contents* | `string` | | | *attributes* | `array` | | | *context* | `SvgElement` | | **returns** ---

Rect :: center

get the Center of the rectangle **returns** ---

Rect :: area

get the Area of the rectangle **returns** ---

Class Text

 Full name: \ASK\Svg\Shapes\Text

a Text element in a svg document

Class Text inherits from class:


Text Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---|

Methods

Class methods

Text :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *contents* | `string` | | | *attributes* | `array` | | | *context* | `SvgElement` | | **returns** ---

The abstract class Command

 Full name: \ASK\Svg\DCommands\Command

A command in a d attribute of a svg path

There are five line commands for <path> nodes.

und five arc commands.

Each command contains a $coordinates array with all the parameters of each point, as well as a reference to the previous command.

Class Command implements:

Command Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*nextPoint*|`int`|| ||*count*|`mixed`|| ||*type*|`string`|| ||*coordinates*|`array`|| ||*prev*|`DCommands\Command`|| ||*position*|`int`|| ||*endPointCoordinates*|`array`||

Command Methods

Class methods

Command :: constructor

| Parameter | Type | Description | |-----------|------|-------------| | *type* | `string` | | | *parameters* | `array` | | | *prev* | `?DCommands\Command` | | **returns** ---

Command :: initialization

initialization is a configuration method for the specific type of command | Parameter | Type | Description | |-----------|------|-------------| | *parameters* | `mixed` | | **returns** ---

Command :: getComand

getComand return the name of the command. Uppercase if it's absolute lowercase if relative **returns** ---

Command :: setEndPoint

setEndPoint set the values of the coordinates of the end point in the command list, both Absolute and Relative | Parameter | Type | Description | |-----------|------|-------------| | *relativePoint* | `array` | | | *absolutePoint* | `array` | | **returns** ---

Command :: toHtml

**returns** ---

Command :: getEndPoint

getEndPoint returns an array with the x and y value of the end point. If the parameter "absolute" is put to true the Absolute value of the end point is returned, relative is returned otherwise | Parameter | Type | Description | |-----------|------|-------------| | *absolute* | `bool` | | **returns** ---

Command :: resetNext

resetNext **returns** ---

Command :: getLastMComand

getLastMComand returns the last M command in the "d" attribute **returns** ---

Command :: getPoint

getPoint returns the array with the x and y parameters of the n point, if the parameter "absolute" is set to true, the Absolute values are returned, relative are retuned otherwise | Parameter | Type | Description | |-----------|------|-------------| | *n* | `int` | | | *absolute* | `bool` | | **returns** ---

Command :: getDinstance

getDinstance get the distance between tow points, if the second parameter is not gived, returns the Absolut distans of the point | Parameter | Type | Description | |-----------|------|-------------| | *fromPoint* | `array` | | | *toPoint* | `array` | | **returns** ---

Class A

 Full name: \ASK\Svg\DCommands\A

A comand "a" in a d attribute of a svg path

Arcs are sections of circles or ellipses. For a given x-radius and y-radius, there are two ellipses that can connect any two points (last end point and (x, y)). Along either of those circles, there are two possible paths that can be taken to connect the points (large way or short way) so in any situation, there are four possible arcs available.

Because of that, arcs require seven parameters: A rx ry x-axis-rotation large-arc-flag sweep-flag x y

a rx ry x-axis-rotation large-arc-flag sweep-flag dx dy

A command hat in aditional to the other commands a getCenter Methode

Class A inherits from class:


A Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---|

Methods

Class methods

A :: initialization

initialization is a configuration method for the specific type of command | Parameter | Type | Description | |-----------|------|-------------| | *parameters* | `mixed` | | **returns** ---

A :: getCenter

getCenter get the centero of the n arc | Parameter | Type | Description | |-----------|------|-------------| | *n* | `int` | the arc number of which we want the center | **returns** ---

Class C

 Full name: \ASK\Svg\DCommands\C

A comand "c" in a d attribute of a svg path

The cubic curve, C, is the slightly more complex curve. Cubic Béziers take in two control points for each point. Therefore, to create a cubic Bézier, three sets of coordinates need to be specified.

C x1 y1, x2 y2, x y c dx1 dy1, dx2 dy2, dx dy

Class C inherits from class:


C Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---|

Methods

Class methods

C :: initialization

initialization is a configuration method for the specific type of command | Parameter | Type | Description | |-----------|------|-------------| | *parameters* | `mixed` | | **returns** ---

Class H

 Full name: \ASK\Svg\DCommands\H

A comand "h" in a d attribute of a svg path

A command draws a horizontal line, this command only take one parameter since they only move in one direction.

H x h dx

Class H inherits from class:


H Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*x*|`float`||

Methods

Class methods

H :: initialization

initialization is a configuration method for the specific type of command | Parameter | Type | Description | |-----------|------|-------------| | *parameters* | `mixed` | | **returns** ---

H :: getX

getX **returns** ---

H :: setX

setX Set the value of x | Parameter | Type | Description | |-----------|------|-------------| | *x* | `float` | | **returns** ---

Class L

 Full name: \ASK\Svg\DCommands\L

A comand "h" in a d attribute of a svg path

L x y l dx dy

Class L inherits from class:


L Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---|

Methods

Class methods

L :: initialization

initialization is a configuration method for the specific type of command | Parameter | Type | Description | |-----------|------|-------------| | *parameters* | `mixed` | | **returns** ---

Class M

 Full name: \ASK\Svg\DCommands\M

A comand "m" in a d attribute of a svg path

M x y m dx dy

Class M inherits from class:


M Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*x*|`float`|| ||*y*|`float`||

Methods

Class methods

M :: initialization

initialization is a configuration method for the specific type of command | Parameter | Type | Description | |-----------|------|-------------| | *parameters* | `mixed` | | **returns** ---

M :: getMDinstance

getMDinstance get the distance between last m point and the point of parameter | Parameter | Type | Description | |-----------|------|-------------| | *toPoint* | `array` | | **returns** ---

M :: getX

Get the value of x **returns** ---

M :: setX

Set the value of x | Parameter | Type | Description | |-----------|------|-------------| | *x* | `float` | | **returns** ---

M :: getY

Get the value of y **returns** ---

M :: setY

Set the value of y | Parameter | Type | Description | |-----------|------|-------------| | *y* | `float` | | **returns** ---

Class Q

 Full name: \ASK\Svg\DCommands\Q

A comand "q" in a d attribute of a svg path

Q x1 y1, x y q dx1 dy1, dx dy

Class Q inherits from class:


Q Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---|

Methods

Class methods

Q :: initialization

initialization is a configuration method for the specific type of command | Parameter | Type | Description | |-----------|------|-------------| | *parameters* | `mixed` | | **returns** ---

Class S

 Full name: \ASK\Svg\DCommands\S

A comand "s" in a d attribute of a svg path

S x2 y2, x y s dx2 dy2, dx dy

Class S inherits from class:


S Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---|

Methods

Class methods

S :: initialization

initialization is a configuration method for the specific type of command | Parameter | Type | Description | |-----------|------|-------------| | *parameters* | `mixed` | | **returns** ---

Class T

 Full name: \ASK\Svg\DCommands\T

A comand "t" in a d attribute of a svg path

T x y t dx dy

Class T inherits from class:


T Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---|

Methods

Class methods

T :: initialization

initialization is a configuration method for the specific type of command | Parameter | Type | Description | |-----------|------|-------------| | *parameters* | `mixed` | | **returns** ---

Class V

 Full name: \ASK\Svg\DCommands\V

A comand "v" in a d attribute of a svg path

V y v dy

Class V inherits from class:


V Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---| ||*y*|`float`||

Methods

Class methods

V :: initialization

initialization is a configuration method for the specific type of command | Parameter | Type | Description | |-----------|------|-------------| | *parameters* | `mixed` | | **returns** ---

V :: getY

getY **returns** ---

V :: setY

setY | Parameter | Type | Description | |-----------|------|-------------| | *y* | `float` | | **returns** ---

Class Z

 Full name: \ASK\Svg\DCommands\Z

A comand "z" in a d attribute of a svg path

Class Z inherits from class:


Z Properties

Class Properties | visibility | Property | Type | Description | |:---|---:|:---|:---|

Methods

Class methods

Z :: initialization

initialization is a configuration method for the specific type of command | Parameter | Type | Description | |-----------|------|-------------| | *parameters* | `mixed` | | **returns** ---

Z :: getPoint

getPoint returns the array with the x and y parameters of the n point, if the parameter "absolute" is set to true, the Absolute values are returned, relative are retuned otherwise | Parameter | Type | Description | |-----------|------|-------------| | *n* | `mixed` | | | *absolute* | `mixed` | | **returns** ---

alphabetical listing


This file is public domain. Use it for any purpose, including commercial applications. Attribution would be nice, but is not required. There is no warranty of any kind, including its correctness, usefulness, or safety.

Author: Alberto Solorzano Kraemer ( [email protected], @betobetok )

This document was automatically generated from source code comments on 2022-03-25 using phpDocumentor and cvuorinen/phpdoc-markdown-public


All versions of ask-svg with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
illuminate/contracts Version ^8.0|^9.0
illuminate/filesystem Version ^8.0|^9.0
illuminate/support Version ^8.0|^9.0
illuminate/view Version ^8.0|^9.0
numphp/numphp Version ^1.2.0
symfony/console Version ^5.3|^6.0
symfony/finder Version ^5.3|^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package betobetok/ask-svg contains the following files

Loading the files please wait ....