{"id":13609078,"url":"https://github.com/tattersoftware/codeigniter4-files","last_synced_at":"2025-08-20T01:31:17.410Z","repository":{"id":35034271,"uuid":"198842743","full_name":"tattersoftware/codeigniter4-files","owner":"tattersoftware","description":"File uploads and management, for CodeIgniter 4","archived":false,"fork":false,"pushed_at":"2024-01-17T22:17:51.000Z","size":437,"stargazers_count":61,"open_issues_count":7,"forks_count":17,"subscribers_count":11,"default_branch":"develop","last_synced_at":"2024-12-13T03:10:59.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tattersoftware.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-25T14:04:24.000Z","updated_at":"2024-03-24T21:19:00.000Z","dependencies_parsed_at":"2024-08-01T19:42:58.106Z","dependency_job_id":"f54097dc-1310-466e-8b13-8e85c6641353","html_url":"https://github.com/tattersoftware/codeigniter4-files","commit_stats":{"total_commits":179,"total_committers":4,"mean_commits":44.75,"dds":"0.35754189944134074","last_synced_commit":"188d1dc1faad1c90c99073074d885ab9c0cfe130"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-files","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-files/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-files/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-files/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tattersoftware","download_url":"https://codeload.github.com/tattersoftware/codeigniter4-files/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230382858,"owners_count":18216854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T19:01:32.278Z","updated_at":"2024-12-19T05:07:22.048Z","avatar_url":"https://github.com/tattersoftware.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Tatter\\Files\nFile uploads and management, for CodeIgniter 4\n\n[![](https://github.com/tattersoftware/codeigniter4-files/workflows/PHPUnit/badge.svg)](https://github.com/tattersoftware/codeigniter4-files/actions/workflows/phpunit.yml)\n[![](https://github.com/tattersoftware/codeigniter4-files/workflows/PHPStan/badge.svg)](https://github.com/tattersoftware/codeigniter4-files/actions/workflows/phpstan.yml)\n[![](https://github.com/tattersoftware/codeigniter4-files/workflows/Deptrac/badge.svg)](https://github.com/tattersoftware/codeigniter4-files/actions/workflows/deptrac.yml)\n[![Coverage Status](https://coveralls.io/repos/github/tattersoftware/codeigniter4-files/badge.svg?branch=develop)](https://coveralls.io/github/tattersoftware/codeigniter4-files?branch=develop)\n\n## Quick Start\n\n1. Install with Composer: `\u003e composer require tatter/files`\n2. Migrate the database: `\u003e php spark migrate -all`\n2. Seed the database: `\u003e php spark db:seed \"Tatter\\Files\\Database\\Seeds\\FileSeeder\"`\n3. Start managing files: https://example.com/files\n\n![image](https://user-images.githubusercontent.com/17572847/96811765-ff82c500-13e9-11eb-9f1d-c9461ef1a438.png)\n![image](https://user-images.githubusercontent.com/17572847/96811782-00b3f200-13ea-11eb-9f39-df56362e1d2b.png)\n![image](https://user-images.githubusercontent.com/17572847/96811800-01e51f00-13ea-11eb-8a2d-f06ae5dff469.png)\n\n## Features\n\nThe Files module is a self-contained set of routes and functions that adds uploading and\nCRUD controls to any project. It uses [DropzoneJS](https://www.dropzonejs.com) for\ndrag-and-drop uploads, and supports a number of extensions for generating file thumbnails\nand exporting files to various destinations.\n\n## Installation\n\nInstall easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities\nand always be up-to-date:\n```shell\n\u003e composer require tatter/files\n```\n\nOr, install manually by downloading the source files and adding the directory to\n**app/Config/Autoload.php**.\n\nOnce the files are downloaded and included in the autoload, run any library migrations\nto ensure the database is setup correctly:\n```shell\n\u003e php spark migrate --all\n```\n\nRun the seeder to install necessary database settings:\n```shell\nphp spark db:seed \"Tatter\\Files\\Database\\Seeds\\FileSeeder\"\n```\n\nFinally, run the framework's Publish Command to copy assets to your public directory:\n```shell\nphp spark publish\n```\n\n**NOTE**: You may need to adjust your **Publisher.php** config file to support `.mjs` files.\n\n## Configuration (optional)\n\nThe library's default behavior can be altered by extending its config file. Copy\n**examples/Files.php** to **app/Config/** and follow the instructions\nin the comments. If no config file is found in **app/Config** the library will use its own.\n\n**NOTE**: If your project is part of a tracking repository you probably want to add the file\nstorage to your **.gitignore**\n```\nwritable/files/*\n!writable/files/index.html\n```\n\n## Usage\n\nDefault routes:\n* **files/index** - If user is allowed `mayList()` then shows all files, otherwise tries to fall back to the current logged in user\n* **files/user/{userId}** - Shows files for a single user; if no user ID is supplied it defaults to the current logged in user\n* **files/thumbnail/{fileId}** - Displays the thumbnail for a file\n\nCRUD:\n* **files/new** - Basic Dropzone form\n* **files/upload** - Accepts AJAX upload requests from Dropzone\n* **files/delete/{fileId}** - Removes a file\n* **files/rename/{fileId}** - Accepts POST data to rename a file\n\nAvailable formats:\n* **?format=cards** - Default view with thumbnail on responsive layout\n* **?format=list** - An efficient list of files in table format\n* **?format=select** - Can be used to create selectable files, e.g. as part of a form\n\n## Access control\n\nThis library uses **Tatter\\Permits** to control access to files, both generally (list, create)\nand specifically per user or group. The super-permit `mayAdmin()` can be added to a user or\ngroup for global file access.\n\nBy default the **files/** routes are available as soon as the module is installed. In most\ncases you will want to use Route Filters to restrict some or all of the routes.\n\n## Extending\n\n**Controllers/Files.php** is the heart of the module, using cascading options to choose\nwhich files to display when. This controller has a `setData()` method to allow you to\nintercept this process to provide your own settings at any point. Simply extend the\ncontroller to your own and then provide whatever changes you would like, followed\nby the `display()` method. E.g.:\n```php\n\u003c?php namespace App\\Controller;\n\nclass WidgetFiles\n{\n\tpublic function index($widgetId)\n\t{\n\t\t$this-\u003esetData([\n\t\t\t'format' =\u003e 'cards',\n\t\t\t'files'  =\u003e model(WidgetModel::class)-\u003egetFiles($widgetId),\n\t\t\t'layout' =\u003e 'manage',\n\t\t]);\n\n\t\treturn $this-\u003edisplay();\n\t}\n}\n\n```\n\nThese are the default options for `setData()`, but you may also supply anything else you\nneed in your view:\n\n* `source` - The name of the controller method making the call\n* `layout` - The view layout to use (see **Config/Files.php**)\n* `files` - An array of Files to display\n* `selected` - Files to pre-select (for the `select` format)\n* `userId` - ID of a user to filter for Files`\n* `username` - Display name of the user for the default layout title\n* `ajax` - Whether to process the request as an AJAX call (skips layout wrapping)\n* `search` - Search term to filter Files\n* `sort` - File sort field\n* `order` - File sort order\n* `format` - Display format for files (cards, list, select, or your own!)\n* `perPage` - Number of items to display per page\n* `page` - Page number (leave `null` for default Pager handling)\n* `pager` - `Pager` instance to handle pagination\n* `access` - Whether the files can be modified, \"manage\" or \"display\"\n* `exports` - Destinations a File may be sent to (see `Tatter\\Exports`)\n* `bulks` - Bulk destinations for a group of Files (see `Tatter\\Exports`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftattersoftware%2Fcodeigniter4-files","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftattersoftware%2Fcodeigniter4-files","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftattersoftware%2Fcodeigniter4-files/lists"}