PHPackages                             okorpheus/document-library - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. okorpheus/document-library

ActivePackage[PDF &amp; Document Generation](/categories/documents)

okorpheus/document-library
==========================

A package to manage a collection of PDF documents

01Blade

Since Feb 3Pushed 3mo agoCompare

[ Source](https://github.com/okorpheus/LarvelDocumentLibrary)[ Packagist](https://packagist.org/packages/okorpheus/document-library)[ RSS](/packages/okorpheus-document-library/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Document Library
================

[](#document-library)

A Laravel package for managing a hierarchical document library with directories, file uploads, and visibility controls.

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

[](#installation)

Add the package to your Laravel application:

```
composer require okorpheus/document-library
```

The service provider is auto-discovered. Run the migrations:

```
php artisan migrate
```

Publish the configuration file:

```
php artisan vendor:publish --tag=documentlibrary-config
```

Configuration
-------------

[](#configuration)

The configuration file will be published to `config/documentlibrary.php`:

```
return [
    // Prefix for database tables
    'db_table_prefix' => env('DOCLIB_DB_TABLE_PREFIX', 'okorpheus_doclib_'),

    // Storage disk for uploaded files
    'storage_disk' => env('DOCLIB_STORAGE_DISK', 'public'),

    // Path within the disk for file storage
    'storage_path' => env('DOCLIB_STORAGE_PATH', 'document-library'),

    // Callable to determine if a user is an admin
    'admin_check' => function ($user) {
        return $user->isAdmin();
    }
];
```

### Admin Check Configuration

[](#admin-check-configuration)

The `admin_check` configuration option determines which users have administrative privileges in the document library. Admins can:

- View all documents and directories regardless of visibility
- Create documents and directories anywhere
- Edit and delete any document or directory

Configure this to match your application's admin logic:

```
// Using a method on the User model
'admin_check' => function ($user) {
    return $user->isAdmin();
}

// Using a role-based system (e.g., Spatie Permissions)
'admin_check' => function ($user) {
    return $user->hasRole('admin');
}

// Using a simple email check
'admin_check' => function ($user) {
    return in_array($user->email, ['admin@example.com']);
}

// Using a database column
'admin_check' => function ($user) {
    return $user->is_admin === true;
}
```

### Environment Variables

[](#environment-variables)

You can configure the package via environment variables:

```
DOCLIB_DB_TABLE_PREFIX=okorpheus_doclib_
DOCLIB_STORAGE_DISK=public
DOCLIB_STORAGE_PATH=document-library
```

Customizing Views
-----------------

[](#customizing-views)

To customize the document library interface, publish the views to your application:

```
php artisan vendor:publish --tag=documentlibrary-views
```

This will copy all views to `resources/views/vendor/document-library/`. You can then modify these files to match your application's design.

### Available Views

[](#available-views)

FileDescription`index.blade.php`Main document library listing page`add-directory-modal.blade.php`Modal for creating new directories`edit-directory-modal.blade.php`Modal for editing directories`upload-file-modal.blade.php`Modal for uploading files`edit-document-modal.blade.php`Modal for editing documents`components/file-list-th.blade.php`Table header component`components/file-list-td.blade.php`Table cell componentThe views use Tailwind CSS and Alpine.js for styling and interactivity. Heroicons are used for icons via the `blade-heroicons` package.

Visibility Levels
-----------------

[](#visibility-levels)

Documents and directories support three visibility levels:

VisibilityDescription`public`Visible to everyone, including guests`restricted`Visible to any authenticated user`private`Visible only to the owner and adminsAuthorization
-------------

[](#authorization)

The package uses Laravel policies for authorization:

### Documents

[](#documents)

- **View**: Based on visibility level and ownership
- **Create**: Authenticated users can create in public directories or directories they own
- **Update**: Owner or admin only
- **Delete**: Owner or admin only

### Directories

[](#directories)

- **View**: Based on visibility level and ownership
- **Create**: Authenticated users can create in public directories or directories they own
- **Update**: Owner or admin only
- **Delete**: Owner or admin only (directory must be empty)

Routes
------

[](#routes)

All routes are prefixed with `/document-library`:

MethodURINameDescriptionGET`/``document-library.index`List root directories and documentsGET`/{directory}``document-library.directory`List contents of a directoryPOST`/directory``document-library.directory.store`Create a new directoryPATCH`/directory/{directory}``document-library.directory.update`Update a directoryDELETE`/directory/{directory}``document-library.directory.destroy`Delete a directoryPOST`/``document-library.file.store`Upload a new filePATCH`/file/{document}``document-library.document.update`Update a documentDELETE`/file/{document}``document-library.document.destroy`Delete a documentUsage
-----

[](#usage)

Navigate to `/document-library` to access the document library interface. Authenticated users can:

- Create directories and upload files
- Edit and delete their own content
- View content based on visibility settings

Admins have full access to all content.

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

[](#requirements)

- PHP 8.2+
- Laravel 11+
- `blade-ui-kit/blade-heroicons` (installed as a dependency)

License
-------

[](#license)

MIT

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance54

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

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/c0cc65ba2be6a1d1492fe205904a0be4f8a89e14c64c0e76d875e6b41cdae57f?d=identicon)[okorpheus](/maintainers/okorpheus)

---

Top Contributors

[![okorpheus](https://avatars.githubusercontent.com/u/541802?v=4)](https://github.com/okorpheus "okorpheus (23 commits)")

### Embed Badge

![Health badge](/badges/okorpheus-document-library/health.svg)

```
[![Health](https://phpackages.com/badges/okorpheus-document-library/health.svg)](https://phpackages.com/packages/okorpheus-document-library)
```

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.2k57.6M131](/packages/openspout-openspout)[keboola/csv

Keboola CSV reader and writer

1451.8M21](/packages/keboola-csv)[setasign/tfpdf

This class is a modified version of FPDF that adds UTF-8 support. The latest version is based on FPDF 1.85.

426.1M30](/packages/setasign-tfpdf)[aspera/xlsx-reader

Spreadsheet reader library for XLSX files

52742.2k5](/packages/aspera-xlsx-reader)

PHPackages © 2026

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