PHPackages                             zunaid/stapler - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. zunaid/stapler

ActiveLibrary[File &amp; Storage](/categories/file-storage)

zunaid/stapler
==============

Elegant and simple ORM-based file upload package for php.

13PHP

Since Jan 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/zunaidmiah/stapler)[ Packagist](https://packagist.org/packages/zunaid/stapler)[ RSS](/packages/zunaid-stapler/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

\#Stapler [![Build Status](https://camo.githubusercontent.com/ec33d75ada4a4dc3ec4397d69bbc1aca64afa5fd95a91401ba92a86f587628ce/68747470733a2f2f7472617669732d63692e6f72672f436f6465536c656576652f737461706c65722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/CodeSleeve/stapler)[![Latest Stable Version](https://camo.githubusercontent.com/d7df9ffacd2dbc58359f4cf38ba90d6ca3a972864d0978d21ee57c19eae3409e/68747470733a2f2f706f7365722e707567782e6f72672f636f6465736c656576652f737461706c65722f762f737461626c652e737667)](https://packagist.org/packages/codesleeve/stapler)[![Total Downloads](https://camo.githubusercontent.com/d731cadee3a315a785071a48ecfb932501e5a0bf7368adf9fbc2d481c844920e/68747470733a2f2f706f7365722e707567782e6f72672f636f6465736c656576652f737461706c65722f646f776e6c6f6164732e737667)](https://packagist.org/packages/codesleeve/stapler)[![Latest Unstable Version](https://camo.githubusercontent.com/77d1777ca9f2903f93cad4c36dbaa89ce232cd1ca23025d502264f936482bf6b/68747470733a2f2f706f7365722e707567782e6f72672f636f6465736c656576652f737461706c65722f762f756e737461626c652e737667)](https://packagist.org/packages/codesleeve/stapler)[![License](https://camo.githubusercontent.com/567bddcc55a14e0f765cf3ac65863148c94615a06874f7f67195d4501990fca4/68747470733a2f2f706f7365722e707567782e6f72672f636f6465736c656576652f737461706c65722f6c6963656e73652e737667)](https://packagist.org/packages/codesleeve/stapler)

**Note**: *If you've previously been using this package, then you've been using it with Laravel. This package is no longer directly coupled to the Laravel framework. As of 1.0.0, Stapler is now framework agnostic. In order to take advantage of the Laravel specific features provided by the previous Beta releases (service providers, IOC container, commands, migration generator, etc) , I've created a separate package specifically for the purpose of using Stapler within Laravel: [Laravel-Stapler](https://github.com/CodeSleeve/laravel-stapler). If you're using Stapler inside a Laravel application I strongly recommend you use this package (it will save you a bit of boilerplate).*

Stapler is a php-based framework agnostic file upload package inspired by the [Ruby Paperclip](https://github.com/thoughtbot/paperclip) gem. It can be used to add file file uploads (as attachment objects) to your ORM records. While not an exact duplicate, if you've used Paperclip before then you should feel quite comfortable using this package.

Stapler was created by [Travis Bennett](https://twitter.com/tandrewbennett).

Requirements
------------

[](#requirements)

Stapler currently requires php &gt;= 5.4 (Stapler is implemented via the use of traits).

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

[](#installation)

Stapler is distributed as a composer package, which is how it should be used in your app.

Install the package using Composer. Edit your project's `composer.json` file to require `codesleeve/stapler`.

```
  "require": {
    "codesleeve/stapler": "1.0.*"
  }
```

About Stapler
-------------

[](#about-stapler)

Stapler works by attaching file uploads to database table records. This is done by defining attachments inside the table's corresponding model and then assigning uploaded files (from your forms) as properties (named after the attachments) on the model before saving it. Stapler will listen to the life cycle callbacks of the model (after save, before delete, and after delete) and handle the file accordingly. In essence, this allows uploaded files to be treated just like any other property on the model; stapler will abstract away all of the file processing, storage, etc so you can focus on the rest of your project without having to worry about where your files are at or how to retrieve them.

### Key Benefits

[](#key-benefits)

- **Modern**: Stapler runs on top of php &gt;= 5.4 and takes advantage of many of the new features provided by modern php (traits, callable typehinting, etc).
- **Simple**: Traditionally, file uploading has been known to be an arduous task; Stapler reduces much of the boilerplate required throughout this process. Seriously, Stapler makes it dead simple to get up and running with file uploads (of any type).
- **Flexible**: Stapler provides an extremely flexible cascading configuration; files can be configured for storage locally or via AWS S3 by changing only a single configuration option.
- **Scalable**: Storing your assets in a central location (such as S3) allows your files to be accessable by multiple web instances from a single location.
- **Powerful**: Stapler makes use of modern object oriented programming patterns in order to provide a rock solid architecture for file uploading. It's trait-based driver system provides the potential for it to work across multiple ORMS (both Active Record and Data Mapper implementations) that implement life cycle callbacks.

Documentation
-------------

[](#documentation)

- [Setup](docs/setup.md)
- [Configuration](docs/configuration.md)
- [Interpolations](docs/interpolations.md)
- [Image Processing](docs/imageprocessing.md)
- [Working with Attachments](docs/attachments.md)
- [Examples](docs/examples.md)
- [Troubleshooting](docs/troubleshooting.md)
- [Contributing](docs/contributing.md)

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/68fc3485332ce0446c0d26fb7cf86800beef561a5f4cd010d83ff2b0c52fc23c?d=identicon)[zunaidmiah](/maintainers/zunaidmiah)

---

Top Contributors

[![zunaidmiah](https://avatars.githubusercontent.com/u/45538749?v=4)](https://github.com/zunaidmiah "zunaidmiah (6 commits)")

### Embed Badge

![Health badge](/badges/zunaid-stapler/health.svg)

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

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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