---
title: Getting Started
---

# Getting Started

<div class="documentation__toc"></div>

## Addon Locations

This section will go over where addons can be loaded from and the difference between `core` and `application` addons.

### Core Addons

All addons listed in the `composer.json` file will be installed by composer in the `/core` directory similar to the `/vendor` directory.

> Only addons required by the root **composer.json** file will resolve dependencies required by the addon's **composer.json** file.{.notice}

### Application Addons

All non-core addons are considered `application` addons and are located in the `/addons` directory.

> Application addons should be committed to the project's repository.{.notice}

Application addons are split into `private` addons and `shared` addons.

### Private Addons

Private addons are located within `/addons/{APP_REF}` directory and are organized by vendor just like the `/core` and `/vendor` directories.

Private addons are only available to the application designated by the `{APP_REF}` directory in which they reside.

### Shared Addons

Shared addons are located within `/addons/shared` directory and are organized by vendor just like the `/core` and `/vendor` directories.

Shared addons are available to all applications within the PyroCMS installation.

### Packaged Addons

Addons can include their own addons. While it is not common the `Grid` and `Repeater` field types are good examples of an addon that come packaged with it's own dependent addons.

Addons can be registered anywhere but when using this technique they are usually found within the `/addons` directory within the addon itself.

## Addon Object

All addon types extend the base `Anomaly\Streams\Platform\Addon\Addon` class and inherit some basic functionality.

### isCore

The `isCore` method returns whether the addon is `core` or not.

```php
if ($addon->isCore()) {
    echo 'Yep!';
}
```

```twig
{% is addon.isCore() %}
    Yep!
{% endif %}
```

### isShared

The `isShared` method returns if the addon is `shared` or not.

```php
if ($addon->isShared()) {
    echo 'Yep!';
}
```

```twig
{% addon.isShared() %}
    Yep!
{% endif %}
```

### getName

The `getName` method returns the translatable name of the addon.

```php
echo trans($addon->getName());
```

```twig
{{ trans(addon.getName()) }}
```

### getTitle

The `getTitle` method returns the `title` which generally similar to the `name` but does not include the addon type.

```php
echo trans($addon->getTitle());
```

```twig
{{ trans(addon.getTitle()) }}
```

### getDescription

The `getDescription` method returns the addon description.

```php
echo trans($addon->getDescription());
```

```twig
{{ trans(addon.getDescription()) }}
```

### getNamespace

The `getNamespace` method returns the addon's `dot namespace` with an optional key.

This is helpful for creating config keys, language keys, hinted view paths, and anything else prefixed by the addon's dot namespace.

An optional `key` can be provided to create a dot-namespace config key for example.

```php
echo $addon->getNamespace();
// anomaly.module.pages

echo $addon->getNamespace('config.limit')
// anomaly.module.pages::config.limit
```

```twig
{{ addon.getNamespace() }}
// anomaly.module.pages

{{ addon.getNamespace('config.limit') }}
// anomaly.module.pages::config.limit
```

You can see how this could be used to generate a config dot-namespace key.

```twig
{{ config(addon.getNamespace('config.limit'), 100) }}
```

### getPath

The `getPath` method returns the addon's installed path.

```php
require_once $addon->getPath() . '/some/old-timer/file.php';
```

### getAppPath

The `getAppPath` returns the relative application path of the addon.

```php
require_once base_path($addon->getAppPath() . '/some/old-timer/file.php');
```

### getType

The `getType` returns the addon `type` in singular form.

```php
if ($addon->getType() == 'field_type') {
    echo "I'm a field type!";
}
```

```twig
{% if addon.getType() == "field_type" %}
    I'm a field type!
{% endif %}
```

### getSlug

The `getSlug` method returns the slug of the addon.

```php
echo $addon->getSlug();
// pages
```

```twig
{{ addon.getSlug() }}
// pages
```

### getVendor

The `getVendor` method returns the vendor string of the addon.

```php
echo $addon->getVendor();
// anomaly
```

```twig
{{ addon.getVendor() }}
// anomaly
```
