PHPackages                             g-varlamov/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. [Database &amp; ORM](/categories/database)
4. /
5. g-varlamov/stapler

ActiveLibrary[Database &amp; ORM](/categories/database)

g-varlamov/stapler
==================

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

v1.0.0(1y ago)01.1kMITPHPPHP &gt;=5.4

Since May 28Pushed 1y agoCompare

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

READMEChangelog (1)Dependencies (7)Versions (2)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

25

—

LowBetter than 37% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 85.3% 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

Unknown

Total

1

Last Release

712d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/920e4b10596d9dc0682aa5b7af51be546de7dc1f464620e0d23c81d519a72dc7?d=identicon)[g-varlamov](/maintainers/g-varlamov)

---

Top Contributors

[![tabennett](https://avatars.githubusercontent.com/u/2191397?v=4)](https://github.com/tabennett "tabennett (238 commits)")[![mvdstam](https://avatars.githubusercontent.com/u/7629384?v=4)](https://github.com/mvdstam "mvdstam (6 commits)")[![benallfree](https://avatars.githubusercontent.com/u/1068356?v=4)](https://github.com/benallfree "benallfree (6 commits)")[![lostincode](https://avatars.githubusercontent.com/u/565885?v=4)](https://github.com/lostincode "lostincode (5 commits)")[![rtablada](https://avatars.githubusercontent.com/u/2532004?v=4)](https://github.com/rtablada "rtablada (5 commits)")[![anhskohbo](https://avatars.githubusercontent.com/u/1529454?v=4)](https://github.com/anhskohbo "anhskohbo (4 commits)")[![hafizbadrie](https://avatars.githubusercontent.com/u/494642?v=4)](https://github.com/hafizbadrie "hafizbadrie (3 commits)")[![sillylogger](https://avatars.githubusercontent.com/u/168183?v=4)](https://github.com/sillylogger "sillylogger (2 commits)")[![KevinCassier](https://avatars.githubusercontent.com/u/537986?v=4)](https://github.com/KevinCassier "KevinCassier (1 commits)")[![aarongustafson](https://avatars.githubusercontent.com/u/75736?v=4)](https://github.com/aarongustafson "aarongustafson (1 commits)")[![marsderp](https://avatars.githubusercontent.com/u/1872386?v=4)](https://github.com/marsderp "marsderp (1 commits)")[![mohangk](https://avatars.githubusercontent.com/u/37199?v=4)](https://github.com/mohangk "mohangk (1 commits)")[![mozmorris](https://avatars.githubusercontent.com/u/156303?v=4)](https://github.com/mozmorris "mozmorris (1 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")[![jorenvanhee](https://avatars.githubusercontent.com/u/231202?v=4)](https://github.com/jorenvanhee "jorenvanhee (1 commits)")[![jasonmccreary](https://avatars.githubusercontent.com/u/161071?v=4)](https://github.com/jasonmccreary "jasonmccreary (1 commits)")[![kara-todd](https://avatars.githubusercontent.com/u/842628?v=4)](https://github.com/kara-todd "kara-todd (1 commits)")[![kdocki](https://avatars.githubusercontent.com/u/772706?v=4)](https://github.com/kdocki "kdocki (1 commits)")

---

Tags

s3awsormfileuploadpaperclip

### Embed Badge

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

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

###  Alternatives

[codesleeve/stapler

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

538366.4k5](/packages/codesleeve-stapler)[codesleeve/laravel-stapler

Easy file upload management for the Laravel Framework.

558413.9k11](/packages/codesleeve-laravel-stapler)[mostafaznv/larupload

Larupload is a ORM based file uploader for laravel to upload image, video, audio and other known files.

73403.7k3](/packages/mostafaznv-larupload)[xety/cake3-upload

Cake3 plugin to upload files.

2825.6k1](/packages/xety-cake3-upload)[torann/mediasort

Attachment manager for Laravel.

2012.5k](/packages/torann-mediasort)

PHPackages © 2026

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