PHPackages                             dd/evolutioncms-snippets-ddgetfileinfo - 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. dd/evolutioncms-snippets-ddgetfileinfo

ActiveModxevo-snippet

dd/evolutioncms-snippets-ddgetfileinfo
======================================

Displays information about a file: type, mime, size in readable format, path, name, extension, etc.

2.5.1(11mo ago)03PHPPHP &gt;=7.4.0

Since Dec 12Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/DivanDesign/EvolutionCMS.snippets.ddGetFileInfo)[ Packagist](https://packagist.org/packages/dd/evolutioncms-snippets-ddgetfileinfo)[ Docs](https://code.divandesign.ru/modx/ddgetfileinfo)[ RSS](/packages/dd-evolutioncms-snippets-ddgetfileinfo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (6)Used By (0)

(MODX)EvolutionCMS.snippets.ddGetFileInfo
=========================================

[](#modxevolutioncmssnippetsddgetfileinfo)

Displays information about a file: type, mime, size in readable format, path, name, extension, etc.

Requires
--------

[](#requires)

- PHP &gt;= 7.4
- [(MODX)EvolutionCMS](https://github.com/evolution-cms/evolution) &gt;= 1.1
- [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.ru/modx/ddtools) &gt;= 0.60

Installation
------------

[](#installation)

### Using [(MODX)EvolutionCMS.libraries.ddInstaller](https://github.com/DivanDesign/EvolutionCMS.libraries.ddInstaller)

[](#using-modxevolutioncmslibrariesddinstaller)

Just run the following PHP code in your sources or [Console](https://github.com/vanchelo/MODX-Evolution-Ajax-Console):

```
// Include (MODX)EvolutionCMS.libraries.ddInstaller
require_once(
	$modx->getConfig('base_path')
	. 'assets/libs/ddInstaller/require.php'
);

// Install (MODX)EvolutionCMS.snippets.ddGetFileInfo
\DDInstaller::install([
	'url' => 'https://github.com/DivanDesign/EvolutionCMS.snippets.ddGetFileInfo',
]);
```

- If `ddGetFileInfo` is not exist on your site, `ddInstaller` will just install it.
- If `ddGetFileInfo` is already exist on your site, `ddInstaller` will check it version and update it if needed.

### Manually

[](#manually)

#### 1. Elements → Snippets: Create a new snippet with the following data

[](#1-elements--snippets-create-a-new-snippet-with-the-following-data)

1. Snippet name: `ddGetFileInfo`.
2. Description: `2.5.1 Displays information about a file: type, mime, size in readable format, path, name, extension, etc.`.
3. Category: `Core`.
4. Parse DocBlock: `no`.
5. Snippet code (php): Insert content of the `ddGetFileInfo_snippet.php` file from the archive.

#### 2. Elements → Manage Files

[](#2-elements--manage-files)

1. Create a new folder `assets/snippets/ddGetFileInfo/`.
2. Extract the archive to the folder (except `ddGetFileInfo_snippet.php`).

Parameters description
----------------------

[](#parameters-description)

- `file`

    - Description: File name (path).
    - Valid values:
        - `stringFilePath` — the path to the file can be specified relative to the site root (`/` at the beginning does not matter, both variants are supported), or the full path (including `$modx->config['base_path']`)
        - `stringUrl` — you can specify not only a local file, but also an Internet address, but in this case not all functions are supported for objective reasons
    - **Required**
- `file_docField`

    - Description: A document field (including TV) containing the path to the file (if you want the snippet to get the file address from the document field).
    - Valid values: `string`
    - Default value: —
- `file_docId`

    - Description: Resource ID, from the field of which you want to get the file address.
    - Valid values: `integerDocId`
    - Default value: —
- `sizeUnitFormat`

    - Description: Format of file size unit.
        - Values are case insensitive (the following names are equal: `'enshort'`, `'EnShort'`, `'ENSHORT'`, etc).
    - Valid values:
        - `'none'`
        - `'EnShort'` — e. g. `MB`
        - `'EnFull'` — e. g. `Megabyte`
        - `'RuShort'` — e. g. `Мб`
        - `'RuFull'` — e. g. `Мегабайт`
    - Default value: `'EnShort'`
- `sizePrecision`

    - Description: The number of decimal digits to round to.
    - Valid values: `integer`
    - Default value: `2`
- `output`

    - Description: File information to output (if `tpl` is not set).
    - Valid values:
        - `'size'`
        - `'extension'`
        - `'type'`
        - `'typeMime'`
        - `'name'`
        - `'path'`
    - Default value: `'size'`
- `tpl`

    - Description: Output template (if the parameter is absent, file data corresponding to `output` will be returned).
        - Available placeholders:
            - `[+file+]` — full file address
            - `[+name+]` — file name
            - `[+path+]` — file path
            - `[+size+]` — file size with a unit in a human-readable format
            - `[+extension+]` — file extension
            - `[+type+]` — file type:
                - `'archive'`
                - `'image'`
                - `'video'`
                - `'audio'`
                - `'text'`
                - `'pdf'`
                - `'word'`
                - `'excel'`
                - `'powerpoint'`
            - `[+typeMime+]` — content type in MIME format (only for local files, not for URLs)
    - Valid values:
        - `stringChunkName`
        - `string` — use inline templates starting with `@CODE:`
    - Default value: —
- `tpl_placeholders`

    - Description: Additional data has to be passed into the `tpl`.
        - Nested objects and arrays are supported too:
            - `{"someOne": "1", "someTwo": "test" }` =&gt; `[+someOne+], [+someTwo+]`.
            - `{"some": {"a": "one", "b": "two"} }` =&gt; `[+some.a+]`, `[+some.b+]`.
            - `{"some": ["one", "two"] }` =&gt; `[+some.0+]`, `[+some.1+]`.
    - Valid values:
        - `stringJsonObject` — as [JSON](https://en.wikipedia.org/wiki/JSON)
        - `stringHjsonObject` — as [HJSON](https://hjson.github.io/)
        - `stringQueryFormatted` — as [Query string](https://en.wikipedia.org/wiki/Query_string)
        - It can also be set as a native PHP object or array (e. g. for calls through `$modx->runSnippet`):
            - `arrayAssociative`
            - `object`
    - Default value: —

Examples
--------

[](#examples)

### Run the snippet through `\DDTools\Snippet::runSnippet` without DB and eval

[](#run-the-snippet-through-ddtoolssnippetrunsnippet-without-db-and-eval)

```
// Include (MODX)EvolutionCMS.libraries.ddTools
require_once(
	$modx->getConfig('base_path')
	. 'assets/libs/ddTools/modx.ddtools.class.php'
);

// Run (MODX)EvolutionCMS.snippets.ddGetFileInfo
\DDTools\Snippet::runSnippet([
	'name' => 'ddGetFileInfo',
	'params' => [
		'file' => 'assets/images/evo-logo.png',
		'output' => 'size',
	],
]);
```

Links
-----

[](#links)

- [Home page](https://code.divandesign.ru/modx/ddgetfileinfo)
- [Telegram chat](https://t.me/dd_code)
- [Packagist](https://packagist.org/packages/dd/evolutioncms-snippets-ddgetfileinfo)
- [GitHub](https://github.com/DivanDesign/EvolutionCMS.snippets.ddGetFileInfo)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance52

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~671 days

Total

4

Last Release

336d ago

PHP version history (3 changes)2.3PHP &gt;=5.4

2.5.0PHP &gt;=5.6.0

2.5.1PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/09b81986267e62b5fde1473b40aa6f11f7bc26c1c29d5f80f2768c8788e08110?d=identicon)[dd](/maintainers/dd)

---

Top Contributors

[![Ronef](https://avatars.githubusercontent.com/u/1333424?v=4)](https://github.com/Ronef "Ronef (51 commits)")

---

Tags

modxMODX Evofile extensionevofile typefile-sizeevolution-cmsfile infomodx evolutionevo cmsevolutioncmsdivandesigndd studiodd groupfile mimehuman readable file sizeddgetfileinfoget file infofile size in human formatreadable file sizefile size in mb

### Embed Badge

![Health badge](/badges/dd-evolutioncms-snippets-ddgetfileinfo/health.svg)

```
[![Health](https://phpackages.com/badges/dd-evolutioncms-snippets-ddgetfileinfo/health.svg)](https://phpackages.com/packages/dd-evolutioncms-snippets-ddgetfileinfo)
```

PHPackages © 2026

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