PHPackages                             betobetok/ask-svg - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. betobetok/ask-svg

ActiveLibrary[Templating &amp; Views](/categories/templating)

betobetok/ask-svg
=================

This is a extention from https://github.com/blade-ui-kit/blade-icons

v0.2.3(4y ago)017MITPHPPHP ^7.4|^8.0

Since Nov 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/betobetok/ask-svg)[ Packagist](https://packagist.org/packages/betobetok/ask-svg)[ Docs](https://github.com/betobetok/ask-svg)[ RSS](/packages/betobetok-ask-svg/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (10)Versions (11)Used By (0)

ASK - PHP Svg Manipulation
==========================

[](#ask---php-svg-manipulation)

[ ![Tests](https://github.com/)](https://github.com/)[ ![Code Style](https://camo.githubusercontent.com/f43615f74ebbda6001f4c142efff254004f73ca345a472da5cae1c92cd0643c8/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f)](https://github.styleci.io/repos/)[ ![Latest Stable Version](https://camo.githubusercontent.com/84884b0abccf4a94bb1f343a43e7566ec116d8cdbaac430a85e5cd4982dd7e7d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f)](https://packagist.org/packages/)[ ![Total Downloads](https://camo.githubusercontent.com/84884b0abccf4a94bb1f343a43e7566ec116d8cdbaac430a85e5cd4982dd7e7d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f)](https://packagist.org/packages/)A package to convert an svg graphic file into a Php object. based on [Blade UIkit](https://github.com/blade-ui-kit/blade-icons)

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.

```
$mySvg = svg('my_svg');
dd($mySvg);
```

svg file [my\_svg.svg](resources/svg/my_svg.svg)

```
ASK\Svg\Svg ({)#427 ▼
  #name: "svg"
  #elements: array:1 [▼
    0 => ASK\Svg\Configurators\G ({)#301 ▼
      #name: "g"
      #elements: array:37 [▶]
      #context: ASK\Svg\Svg ({)#427(})
      #transforms: ASK\Svg\Transformation ({)#424 ▼
        #transformations: array:1 [▼
          0 => array:1 [▼
            "matrix" => NumPHP\Core\NumArray ({)#423 ▶(})
          ]
        ]
      (})
      #isTransformable: true
      -attributes: array:1 [▶]
      +"g": array:37 [▶]
    (})
  ]
  #context: null
  #isTransformable: false
  -attributes: array:6 [▼
    "id" => "my_svg"
    "width" => "473"
    "height" => "477"
    "viewBox" => "0 0 473 477"
    "fill" => "none"
    "xmlns" => "http://www.w3.org/2000/svg"
  ]
  +style: ASK\Svg\Configurators\Style ({)#426 ▼
    #name: "style"
    #context: ASK\Svg\Svg ({)#427(})
    #isTransformable: false
    -attributes: []
    -classes: []
    -rules: []
  (})
  +"g": array:1 [▼
    0 => ASK\Svg\Configurators\G ({)#301 ▶(})
  ]
(})

```

---

The Svg class
--------------

[](#the-svg-class-)

```
 Full name: \ASK\Svg\Svg
```

the Svg document

Class ***Svg*** implements: `\ASK\Svg\Conteiner`

### Svg Properties

[](#svg-properties)

Class PropertiesvisibilityPropertyTypeDescription`public`*style*`Configurators\Style`---

### Svg Methods

[](#svg-methods)

Class methods Svg :: constructor
--------------------

[](#-svg--constructor-)

```
Svg (string fileName, string contents, array attributes = []): mixed
```

ParameterTypeDescription*fileName*`string`*contents*`string`*attributes*`array`**returns**

---

 Svg :: getStylefromContent
----------------------------

[](#-svg--getstylefromcontent-)

get the Style element from the string content

```
public getStylefromContent(): string
```

**returns**

---

 Svg :: removeStylefromContent
-------------------------------

[](#-svg--removestylefromcontent-)

remove the string Style from the string content

```
public removeStylefromContent(): self
```

**returns**

---

 Svg :: style
--------------

[](#-svg--style-)

get the Style element

```
public style(): Configurators\Style
```

**returns**

---

 Svg :: setStyle
-----------------

[](#-svg--setstyle-)

set the Style element

```
public setStyle(Configurators\Style style): self
```

ParameterTypeDescription*style*`Configurators\Style`**returns**

---

 Svg :: replaceClasses
-----------------------

[](#-svg--replaceclasses-)

replace the Classes names in the string content

```
public replaceClasses(Configurators\Style style, string content): string
```

ParameterTypeDescription*style*`Configurators\Style`*content*`string`**returns**

---

 Svg :: mergeSvgs
------------------

[](#-svg--mergesvgs-)

merge one or more Svgs in this svg

```
public mergeSvgs(Svg[] param): Svg
```

ParameterTypeDescription*param*`Svg[]`**returns**

---

 Svg :: toHtml
---------------

[](#-svg--tohtml-)

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

```
public toHtml(): string
```

**returns**

---

 Svg :: getAllSvgElements
--------------------------

[](#-svg--getallsvgelements-)

get all the Svg elements in this svg, this array conteins all the elements in order

```
public getAllSvgElements(mixed svg): array
```

ParameterTypeDescription*svg*`mixed`**returns**

---

 Svg :: cleanContent
---------------------

[](#-svg--cleancontent-)

cleanContent remove all string contents in the complet object

```
public cleanContent(): self
```

**returns**

---

 Svg :: getContent
-------------------

[](#-svg--getcontent-)

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

```
public getContent(): mixed
```

**returns**

---

 Svg :: setContent
-------------------

[](#-svg--setcontent-)

Set the value of content (Conteiner implement) //TODO implementation of container

```
public setContent(mixed content): self
```

ParameterTypeDescription*content*`mixed`**returns**

---

 Svg :: removeSvgAttribute
---------------------------

[](#-svg--removesvgattribute-)

removes those attributes that belong exclusively to the svg element

```
public removeSvgAttribute(): void
```

**returns**

---

 Svg :: getOnlySvgAttribute
----------------------------

[](#-svg--getonlysvgattribute-)

get those attributes that belong exclusively to the svg element

```
public getOnlySvgAttribute(): array
```

**returns**

---

---

---

The SvgElement class
---------------------

[](#the-svgelement-class-)

```
 Full name: \ASK\Svg\SvgElement
```

An element belonging to a svg structure
=======================================

[](#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 &amp;lt;path&amp;gt;, &amp;lt;circle&amp;gt; or &amp;lt;g&amp;gt;, passing through configuration elements such as &amp;lt;style&amp;gt;, &amp;lt;defs&amp;gt; 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:

- $svg-&gt;g returns all &lt;g&gt; elements
- $svg-&gt;elements\[0\] return the first element in the &lt;svg&gt;&lt;/svg&gt;
- $svg-&gt;g\[0\]-&gt;elements\[0\] return the first element in the &lt;g&gt;&lt;/g&gt;

Class ***SvgElement*** implements: `\Illuminate\Contracts\Support\Htmlable`

### SvgElement Properties

[](#svgelement-properties)

Class PropertiesvisibilityPropertyTypeDescription`protected`*name*`string``protected`*elements*`SvgElement[]``protected`*contents*`string``protected`*context*`SvgElement``protected`*transforms*`Transformation``protected`*isTransformable*`bool`---

### SvgElement Methods

[](#svgelement-methods)

Class methods SvgElement :: constructor
---------------------------

[](#-svgelement--constructor-)

```
SvgElement (string name, string contents, array attributes = [], SvgElement context = null): mixed
```

ParameterTypeDescription*name*`string`*contents*`string`*attributes*`array`*context*`SvgElement`**returns**

---

 SvgElement :: makeTransformable
---------------------------------

[](#-svgelement--maketransformable-)

Make this element Transformable

```
public makeTransformable(): void
```

**returns**

---

 SvgElement :: makeUntransformable
-----------------------------------

[](#-svgelement--makeuntransformable-)

make this element Untransformable

```
public makeUntransformable(): void
```

**returns**

---

 SvgElement :: name
--------------------

[](#-svgelement--name-)

get or set the name of the element

```
public name(string arg = &#039;&#039;): string|self
```

ParameterTypeDescription*arg*`string`**returns**

---

 SvgElement :: id
------------------

[](#-svgelement--id-)

get or set the id attribute of the element in the attributes property

```
public id(string arg = &#039;&#039;): string|self
```

ParameterTypeDescription*arg*`string`**returns**

---

 SvgElement :: transform
-------------------------

[](#-svgelement--transform-)

set or get the Transformation Object for the element

```
public transform(mixed arg = null): Transformation|string
```

ParameterTypeDescription*arg*`mixed`**returns**

---

 SvgElement :: contents
------------------------

[](#-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

```
public contents(): string
```

**returns**

---

 SvgElement :: removeContents
------------------------------

[](#-svgelement--removecontents-)

remove the string Contents property from the object

```
public removeContents(): self
```

**returns**

---

 SvgElement :: setContents
---------------------------

[](#-svgelement--setcontents-)

set the string Contents property in the object

```
public setContents(string contents): self
```

ParameterTypeDescription*contents*`string`**returns**

---

 SvgElement :: getContext
--------------------------

[](#-svgelement--getcontext-)

get the property Context that is the parent SVG element of this element

```
public getContext(): SvgElement|null
```

**returns**

---

 SvgElement :: getAllElements
------------------------------

[](#-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

```
public getAllElements(): void
```

**returns**

---

 SvgElement :: setElement
--------------------------

[](#-svgelement--setelement-)

set a neu Element in this object

```
public setElement(string name, mixed element): void
```

ParameterTypeDescription*name*`string`*element*`mixed`**returns**

---

 SvgElement :: mergeAttributes
-------------------------------

[](#-svgelement--mergeattributes-)

merge the attributes conteined in a string tag with the array attributes

```
public mergeAttributes(string tag, array attributes): array
```

ParameterTypeDescription*tag*`string`*attributes*`array`**returns**

---

 SvgElement :: removeComents
-----------------------------

[](#-svgelement--removecoments-)

remove coments from the string content

```
public removeComents(): self
```

**returns**

---

 SvgElement :: toHtml
----------------------

[](#-svgelement--tohtml-)

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

```
public toHtml(): string
```

**returns**

---

 SvgElement :: removeId
------------------------

[](#-svgelement--removeid-)

remove the property Id

```
public removeId(): self
```

**returns**

---

 SvgElement :: toArray
-----------------------

[](#-svgelement--toarray-)

toArray

```
public toArray(): void
```

**returns**

---

 SvgElement :: serialize
-------------------------

[](#-svgelement--serialize-)

```
public serialize(mixed data): mixed
```

ParameterTypeDescription*data*`mixed`**returns**

---

 SvgElement :: unserialize
---------------------------

[](#-svgelement--unserialize-)

```
public unserialize(mixed data): mixed
```

ParameterTypeDescription*data*`mixed`**returns**

---

 SvgElement :: findFirstGroupElement
-------------------------------------

[](#-svgelement--findfirstgroupelement-)

find the first group element with the name $element and return the new corresponding SvgElement instance or null if not found

```
public findFirstGroupElement(string element): SvgElement|null
```

ParameterTypeDescription*element*`string`**returns**

---

 SvgElement :: findFirstElement
--------------------------------

[](#-svgelement--findfirstelement-)

return the first Element in the elements array or null if not found

```
public findFirstElement(string elementName): SvgElement|null
```

ParameterTypeDescription*elementName*`string`**returns**

---

 SvgElement :: findFirstNonGroupElement
----------------------------------------

[](#-svgelement--findfirstnongroupelement-)

find the first non-group element with the name $element and return the new corresponding SvgElement instance or null if not found

```
public findFirstNonGroupElement(string element): SvgElement|null
```

ParameterTypeDescription*element*`string`**returns**

---

 SvgElement :: getElementAttributes
------------------------------------

[](#-svgelement--getelementattributes-)

get the attributes of a element froma string tag ()

```
public getElementAttributes(string tag): array
```

ParameterTypeDescription*tag*`string`**returns**

---

 SvgElement :: getTransformations
----------------------------------

[](#-svgelement--gettransformations-)

get the Transformations of the element and make the corresponding Transformation Object

```
public getTransformations(): void
```

**returns**

---

 SvgElement :: getElementById
------------------------------

[](#-svgelement--getelementbyid-)

find an element by its id and return it or null if not found

```
public getElementById(string id): SvgElement|null
```

ParameterTypeDescription*id*`string`**returns**

---

 SvgElement :: getStartPointById
---------------------------------

[](#-svgelement--getstartpointbyid-)

get the start position point of an Shape element by its Id and return it or null if not found

```
public getStartPointById(string id): \NumPHP\Core\NumArray|null
```

ParameterTypeDescription*id*`string`**returns**

---

 SvgElement :: hasContext
--------------------------

[](#-svgelement--hascontext-)

return true if the element has content or false otherwise

```
public hasContext(): void
```

**returns**

---

---

---

The abstract class Shape
------------------------

[](#the-abstract-class-shape)

```
 Full name: \ASK\Svg\Shapes\Shape
```

An element that make a Shape in a svg document

### Shape Properties

[](#shape-properties)

Class PropertiesvisibilityPropertyTypeDescription`protected`*startPosition*`\NumPHP\Core\NumArray`---

### Shape Methods

[](#shape-methods)

Class methods Shape :: constructor
----------------------

[](#-shape--constructor-)

```
Shape (string contents, array attributes = [], SvgElement context = null): mixed
```

ParameterTypeDescription*contents*`string`*attributes*`array`*context*`SvgElement`**returns**

---

 Shape :: getStartPosition
---------------------------

[](#-shape--getstartposition-)

get the Start position o the element

```
public getStartPosition(): void
```

**returns**

---

 Shape :: renderAttributes
---------------------------

[](#-shape--renderattributes-)

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

```
protected renderAttributes(): string
```

**returns**

---

 Shape :: toHtml
-----------------

[](#-shape--tohtml-)

(overloaded Method from SvgElement)

```
public toHtml(): string
```

**returns**

---

---

Class Circle
------------

[](#class-circle)

```
 Full name: \ASK\Svg\Shapes\Circle
```

A Circle element in a svg document

Class ***Circle*** inherits from class: `Shape`

---

### Circle Properties

[](#circle-properties)

Class PropertiesvisibilityPropertyTypeDescription`protected`*cx*`float``protected`*cy*`float``protected`*r*`float`---

### Methods

[](#methods)

Class methods Circle :: constructor
-----------------------

[](#-circle--constructor-)

```
Circle (string contents, array attributes = [], SvgElement context = null): mixed
```

ParameterTypeDescription*contents*`string`*attributes*`array`*context*`SvgElement`**returns**

---

 Circle :: center
------------------

[](#-circle--center-)

get the center of the circle

```
public center(): \NumPHP\Core\NumArray
```

**returns**

---

 Circle :: diameter
--------------------

[](#-circle--diameter-)

get the Diameter of the circle

```
public diameter(): float
```

**returns**

---

 Circle :: radio
-----------------

[](#-circle--radio-)

get the Radio of the circle

```
public radio(): float
```

**returns**

---

 Circle :: area
----------------

[](#-circle--area-)

get the Area of the circle

```
public area(): float
```

**returns**

---

---

Class Ellipse
-------------

[](#class-ellipse)

```
 Full name: \ASK\Svg\Shapes\Ellipse
```

A Ellipse element in a svg document

Class ***Ellipse*** inherits from class: `Shape`

---

### Ellipse Properties

[](#ellipse-properties)

Class PropertiesvisibilityPropertyTypeDescription`protected`*cx*`float``protected`*cy*`float``protected`*rx*`float``protected`*ry*`float`---

### Methods

[](#methods-1)

Class methods Ellipse :: constructor
------------------------

[](#-ellipse--constructor-)

```
Ellipse (string contents, array attributes = [], SvgElement context = null): mixed
```

ParameterTypeDescription*contents*`string`*attributes*`array`*context*`SvgElement`**returns**

---

 Ellipse :: center
-------------------

[](#-ellipse--center-)

get the Center of the ellipse

```
public center(): \NumPHP\Core\NumArray
```

**returns**

---

 Ellipse :: radioX
-------------------

[](#-ellipse--radiox-)

get the x Radio of the ellipse

```
public radioX(): float
```

**returns**

---

 Ellipse :: radioY
-------------------

[](#-ellipse--radioy-)

get the y Radio of the ellipse

```
public radioY(): float
```

**returns**

---

 Ellipse :: area
-----------------

[](#-ellipse--area-)

get the Area of the ellipse

```
public area(): float
```

**returns**

---

---

Class Line
----------

[](#class-line)

```
 Full name: \ASK\Svg\Shapes\Line
```

A Line element in a svg document

Class ***Line*** inherits from class: `Shape`

---

### Line Properties

[](#line-properties)

Class PropertiesvisibilityPropertyTypeDescription`protected`*x1*`float``protected`*y1*`float``protected`*x2*`float``protected`*y2*`float`---

### Methods

[](#methods-2)

Class methods Line :: constructor
---------------------

[](#-line--constructor-)

```
Line (string contents, array attributes = [], SvgElement context = null): mixed
```

ParameterTypeDescription*contents*`string`*attributes*`array`*context*`SvgElement`**returns**

---

 Line :: long
--------------

[](#-line--long-)

get teh Logitud of the line

```
public long(): float
```

**returns**

---

---

Class Path
----------

[](#class-path)

```
 Full name: \ASK\Svg\Shapes\Path
```

A Path element in a svg document

Class ***Path*** inherits from class: `Shape`

---

### Path Properties

[](#path-properties)

Class PropertiesvisibilityPropertyTypeDescription`private`*dString*`string``protected`*d*`array`---

### Methods

[](#methods-3)

Class methods Path :: constructor
---------------------

[](#-path--constructor-)

```
Path (string contents, array attributes = [], SvgElement context = null): mixed
```

ParameterTypeDescription*contents*`string`*attributes*`array`*context*`SvgElement`**returns**

---

 Path :: toHtml
----------------

[](#-path--tohtml-)

(overloaded Method from SvgElement)

```
public toHtml(): string
```

**returns**

---

 Path :: content
-----------------

[](#-path--content-)

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

```
public content(): string
```

**returns**

---

 Path :: getExistingComands
----------------------------

[](#-path--getexistingcomands-)

getExistingComands get the existing comands in a d attribute from a string

```
public getExistingComands(string d): array
```

ParameterTypeDescription*d*`string`**returns**

---

 Path :: renderAttributes
--------------------------

[](#-path--renderattributes-)

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

```
protected renderAttributes(): string
```

**returns**

---

---

Class Polygon
-------------

[](#class-polygon)

```
 Full name: \ASK\Svg\Shapes\Polygon
```

A Polygon element in a svg document

Class ***Polygon*** inherits from class: `Shape`

---

### Polygon Properties

[](#polygon-properties)

Class PropertiesvisibilityPropertyTypeDescription`protected`*points*`array`---

### Methods

[](#methods-4)

Class methods Polygon :: constructor
------------------------

[](#-polygon--constructor-)

```
Polygon (string contents, array attributes = [], SvgElement context = null): mixed
```

ParameterTypeDescription*contents*`string`*attributes*`array`*context*`SvgElement`**returns**

---

 Polygon :: toHtml
-------------------

[](#-polygon--tohtml-)

(overloaded Method from SvgElement)

```
public toHtml(): string
```

**returns**

---

 Polygon :: getPoints
----------------------

[](#-polygon--getpoints-)

get the array Points from a string

```
public getPoints(string points): array
```

ParameterTypeDescription*points*`string`**returns**

---

---

Class Polyline
--------------

[](#class-polyline)

```
 Full name: \ASK\Svg\Shapes\Polyline
```

A Polyline element in a svg document

Class ***Polyline*** inherits from class: `Shape`

---

### Polyline Properties

[](#polyline-properties)

Class PropertiesvisibilityPropertyTypeDescription`protected`*points*`array`---

### Methods

[](#methods-5)

Class methods Polyline :: constructor
-------------------------

[](#-polyline--constructor-)

```
Polyline (string contents, array attributes = [], SvgElement context = null): mixed
```

ParameterTypeDescription*contents*`string`*attributes*`array`*context*`SvgElement`**returns**

---

 Polyline :: toHtml
--------------------

[](#-polyline--tohtml-)

(overloaded Method from SvgElement)

```
public toHtml(): string
```

**returns**

---

 Polyline :: getPoints
-----------------------

[](#-polyline--getpoints-)

get the array Points from a string

```
public getPoints(string points): array
```

ParameterTypeDescription*points*`string`**returns**

---

---

Class Rect
----------

[](#class-rect)

```
 Full name: \ASK\Svg\Shapes\Rect
```

A Rect element in a svg document

Class ***Rect*** inherits from class: `Shape`

---

### Rect Properties

[](#rect-properties)

Class PropertiesvisibilityPropertyTypeDescription`protected`*x*`float``protected`*y*`float``protected`*width*`float``protected`*height*`float``protected`*rx*`float``protected`*ry*`float`---

### Methods

[](#methods-6)

Class methods Rect :: constructor
---------------------

[](#-rect--constructor-)

```
Rect (string contents, array attributes = [], SvgElement context = null): mixed
```

ParameterTypeDescription*contents*`string`*attributes*`array`*context*`SvgElement`**returns**

---

 Rect :: center
----------------

[](#-rect--center-)

get the Center of the rectangle

```
public center(): \NumPHP\Core\NumArray
```

**returns**

---

 Rect :: area
--------------

[](#-rect--area-)

get the Area of the rectangle

```
public area(): float
```

**returns**

---

---

Class Text
----------

[](#class-text)

```
 Full name: \ASK\Svg\Shapes\Text
```

a Text element in a svg document

Class ***Text*** inherits from class: `Shape`

---

### Text Properties

[](#text-properties)

Class PropertiesvisibilityPropertyTypeDescription---

### Methods

[](#methods-7)

Class methods Text :: constructor
---------------------

[](#-text--constructor-)

```
Text (string contents, array attributes = [], SvgElement context = null): mixed
```

ParameterTypeDescription*contents*`string`*attributes*`array`*context*`SvgElement`**returns**

---

---

The abstract class Command
--------------------------

[](#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 &lt;path&gt; nodes.

- M - *Move*
- L - *Line*
- H - *Horizontal*
- V - *Vertical*
- Z - *Close*

und five arc commands.

- C - *Cubic Curve*
- Q - *Quadratic Curve*
- S - *Short Cubic Curve*
- T - *Together Multiple Quadratic Curve*
- A - *Arc*

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: `\Illuminate\Contracts\Support\Htmlable`

### Command Properties

[](#command-properties)

Class PropertiesvisibilityPropertyTypeDescription`protected`*nextPoint*`int``protected`*count*`mixed``protected`*type*`string``protected`*coordinates*`array``protected`*prev*`DCommands\Command``protected`*position*`int``protected`*endPointCoordinates*`array`---

### Command Methods

[](#command-methods)

Class methods Command :: constructor
------------------------

[](#-command--constructor-)

```
Command (string type, array parameters = [], ?DCommands\Command prev = null): mixed
```

ParameterTypeDescription*type*`string`*parameters*`array`*prev*`?DCommands\Command`**returns**

---

 Command :: initialization
---------------------------

[](#-command--initialization-)

initialization is a configuration method for the specific type of command

```
public initialization(mixed parameters): void
```

ParameterTypeDescription*parameters*`mixed`**returns**

---

 Command :: getComand
----------------------

[](#-command--getcomand-)

getComand

return the name of the command. Uppercase if it's absolute lowercase if relative

```
public getComand(): string
```

**returns**

---

 Command :: setEndPoint
------------------------

[](#-command--setendpoint-)

setEndPoint set the values of the coordinates of the end point in the command list, both Absolute and Relative

```
public setEndPoint(array relativePoint, array absolutePoint): void
```

ParameterTypeDescription*relativePoint*`array`*absolutePoint*`array`**returns**

---

 Command :: toHtml
-------------------

[](#-command--tohtml-)

```
public toHtml(): mixed
```

**returns**

---

 Command :: getEndPoint
------------------------

[](#-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

```
public getEndPoint(bool absolute = true): array
```

ParameterTypeDescription*absolute*`bool`**returns**

---

 Command :: resetNext
----------------------

[](#-command--resetnext-)

resetNext

```
public resetNext(): void
```

**returns**

---

 Command :: getLastMComand
---------------------------

[](#-command--getlastmcomand-)

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

```
public getLastMComand(): DCommands\Command|null
```

**returns**

---

 Command :: getPoint
---------------------

[](#-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

```
public getPoint(int n = null, bool absolute = false): array
```

ParameterTypeDescription*n*`int`*absolute*`bool`**returns**

---

 Command :: getDinstance
-------------------------

[](#-command--getdinstance-)

getDinstance get the distance between tow points, if the second parameter is not gived, returns the Absolut distans of the point

```
public getDinstance(array fromPoint, array toPoint = []): array
```

ParameterTypeDescription*fromPoint*`array`*toPoint*`array`**returns**

---

---

Class A
-------

[](#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: `Command`

---

### A Properties

[](#a-properties)

Class PropertiesvisibilityPropertyTypeDescription---

### Methods

[](#methods-8)

Class methods A :: initialization
---------------------

[](#-a--initialization-)

initialization is a configuration method for the specific type of command

```
public initialization(mixed parameters): void
```

ParameterTypeDescription*parameters*`mixed`**returns**

---

 A :: getCenter
----------------

[](#-a--getcenter-)

getCenter get the centero of the n arc

```
public getCenter(int n = null): array
```

ParameterTypeDescription*n*`int`the arc number of which we want the center**returns**

---

---

Class C
-------

[](#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: `Command`

---

### C Properties

[](#c-properties)

Class PropertiesvisibilityPropertyTypeDescription---

### Methods

[](#methods-9)

Class methods C :: initialization
---------------------

[](#-c--initialization-)

initialization is a configuration method for the specific type of command

```
public initialization(mixed parameters): void
```

ParameterTypeDescription*parameters*`mixed`**returns**

---

---

Class H
-------

[](#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: `Command`

---

### H Properties

[](#h-properties)

Class PropertiesvisibilityPropertyTypeDescription`protected`*x*`float`---

### Methods

[](#methods-10)

Class methods H :: initialization
---------------------

[](#-h--initialization-)

initialization is a configuration method for the specific type of command

```
public initialization(mixed parameters): void
```

ParameterTypeDescription*parameters*`mixed`**returns**

---

 H :: getX
-----------

[](#-h--getx-)

getX

```
public getX(): float
```

**returns**

---

 H :: setX
-----------

[](#-h--setx-)

setX Set the value of x

```
public setX(float x): self
```

ParameterTypeDescription*x*`float`**returns**

---

---

Class L
-------

[](#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: `Command`

---

### L Properties

[](#l-properties)

Class PropertiesvisibilityPropertyTypeDescription---

### Methods

[](#methods-11)

Class methods L :: initialization
---------------------

[](#-l--initialization-)

initialization is a configuration method for the specific type of command

```
public initialization(mixed parameters): void
```

ParameterTypeDescription*parameters*`mixed`**returns**

---

---

Class M
-------

[](#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: `Command`

---

### M Properties

[](#m-properties)

Class PropertiesvisibilityPropertyTypeDescription`private`*x*`float``private`*y*`float`---

### Methods

[](#methods-12)

Class methods M :: initialization
---------------------

[](#-m--initialization-)

initialization is a configuration method for the specific type of command

```
public initialization(mixed parameters): void
```

ParameterTypeDescription*parameters*`mixed`**returns**

---

 M :: getMDinstance
--------------------

[](#-m--getmdinstance-)

getMDinstance get the distance between last m point and the point of parameter

```
public getMDinstance(array toPoint = []): array
```

ParameterTypeDescription*toPoint*`array`**returns**

---

 M :: getX
-----------

[](#-m--getx-)

Get the value of x

```
public getX(): float
```

**returns**

---

 M :: setX
-----------

[](#-m--setx-)

Set the value of x

```
public setX(float x): self
```

ParameterTypeDescription*x*`float`**returns**

---

 M :: getY
-----------

[](#-m--gety-)

Get the value of y

```
public getY(): float
```

**returns**

---

 M :: setY
-----------

[](#-m--sety-)

Set the value of y

```
public setY(float y): self
```

ParameterTypeDescription*y*`float`**returns**

---

---

Class Q
-------

[](#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: `Command`

---

### Q Properties

[](#q-properties)

Class PropertiesvisibilityPropertyTypeDescription---

### Methods

[](#methods-13)

Class methods Q :: initialization
---------------------

[](#-q--initialization-)

initialization is a configuration method for the specific type of command

```
public initialization(mixed parameters): void
```

ParameterTypeDescription*parameters*`mixed`**returns**

---

---

Class S
-------

[](#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: `Command`

---

### S Properties

[](#s-properties)

Class PropertiesvisibilityPropertyTypeDescription---

### Methods

[](#methods-14)

Class methods S :: initialization
---------------------

[](#-s--initialization-)

initialization is a configuration method for the specific type of command

```
public initialization(mixed parameters): void
```

ParameterTypeDescription*parameters*`mixed`**returns**

---

---

Class T
-------

[](#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: `Command`

---

### T Properties

[](#t-properties)

Class PropertiesvisibilityPropertyTypeDescription---

### Methods

[](#methods-15)

Class methods T :: initialization
---------------------

[](#-t--initialization-)

initialization is a configuration method for the specific type of command

```
public initialization(mixed parameters): void
```

ParameterTypeDescription*parameters*`mixed`**returns**

---

---

Class V
-------

[](#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: `Command`

---

### V Properties

[](#v-properties)

Class PropertiesvisibilityPropertyTypeDescription`protected`*y*`float`---

### Methods

[](#methods-16)

Class methods V :: initialization
---------------------

[](#-v--initialization-)

initialization is a configuration method for the specific type of command

```
public initialization(mixed parameters): void
```

ParameterTypeDescription*parameters*`mixed`**returns**

---

 V :: getY
-----------

[](#-v--gety-)

getY

```
public getY(): float
```

**returns**

---

 V :: setY
-----------

[](#-v--sety-)

setY

```
public setY(float y): self
```

ParameterTypeDescription*y*`float`**returns**

---

---

Class Z
-------

[](#class-z)

```
 Full name: \ASK\Svg\DCommands\Z
```

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

Class ***Z*** inherits from class: `Command`

---

### Z Properties

[](#z-properties)

Class PropertiesvisibilityPropertyTypeDescription---

### Methods

[](#methods-17)

Class methods Z :: initialization
---------------------

[](#-z--initialization-)

initialization is a configuration method for the specific type of command

```
public initialization(mixed parameters): void
```

ParameterTypeDescription*parameters*`mixed`**returns**

---

 Z :: getPoint
---------------

[](#-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

```
public getPoint(mixed n = null, mixed absolute = true): array
```

ParameterTypeDescription*n*`mixed`*absolute*`mixed`**returns**

---

---

alphabetical listing
--------------------

[](#alphabetical-listing)

- [Svg - the Svg document](#Svg).
- [SvgElement - # An element belonging to a svg structure](#SvgElement).
- [Shape - An element that make a Shape in a svg document](#Shape).
    - [Circle - A Circle element in a svg document](#Circle).
    - [Ellipse - A Ellipse element in a svg document](#Ellipse).
    - [Line - A Line element in a svg document](#Line).
    - [Path - A Path element in a svg document](#Path).
    - [Polygon - A Polygon element in a svg document](#Polygon).
    - [Polyline - A Polyline element in a svg document](#Polyline).
    - [Rect - A Rect element in a svg document](#Rect).
    - [Text - a Text element in a svg document](#Text).
- [Command - A command in a *d* attribute of a svg path](#Command).
    - [A - A comand "a" in a d attribute of a svg path](#A).
    - [C - A comand "c" in a d attribute of a svg path](#C).
    - [H - A comand "h" in a d attribute of a svg path](#H).
    - [L - A comand "h" in a d attribute of a svg path](#L).
    - [M - A comand "m" in a d attribute of a svg path](#M).
    - [Q - A comand "q" in a d attribute of a svg path](#Q).
    - [S - A comand "s" in a d attribute of a svg path](#S).
    - [T - A comand "t" in a d attribute of a svg path](#T).
    - [V - A comand "v" in a d attribute of a svg path](#V).
    - [Z - A comand "z" in a d attribute of a svg path](#Z).

---

> 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 ( , @betobetok )**

---

> This document was automatically generated from source code comments on 2022-03-25 using [phpDocumentor](http://www.phpdoc.org/)and [cvuorinen/phpdoc-markdown-public](https://github.com/cvuorinen/phpdoc-markdown-public)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~51 days

Total

7

Last Release

1325d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a26f2c8c8071ccd40541afa6a5ce92755ed728b750407ce2c6d469e2e3141375?d=identicon)[betobetok](/maintainers/betobetok)

---

Top Contributors

[![betobetok](https://avatars.githubusercontent.com/u/49210546?v=4)](https://github.com/betobetok "betobetok (95 commits)")

---

Tags

laraveliconssvgblade

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/betobetok-ask-svg/health.svg)

```
[![Health](https://phpackages.com/badges/betobetok-ask-svg/health.svg)](https://phpackages.com/packages/betobetok-ask-svg)
```

###  Alternatives

[blade-ui-kit/blade-icons

A package to easily make use of icons in your Laravel Blade views.

2.5k34.2M309](/packages/blade-ui-kit-blade-icons)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[laravel/folio

Page based routing for Laravel.

608453.9k27](/packages/laravel-folio)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
