Convert Figma logo to code with AI

AudithSoftworks logoUniform

A jQuery plugin to make your form controls look how you want them to. Now with HTML-5 attributes!

2,198
337
2,198
20

Top Related Projects

9,703

Eases the creation of beautiful and testable command line interfaces

🍃 In short, it's like Tailwind CSS, but for the PHP command-line applications.

Provides mechanisms for walking through any arbitrary PHP variable

Quick Overview

Uniform is a PHP library that provides a unified interface for handling file uploads across different storage backends. It simplifies the process of managing file uploads by abstracting away the complexities of different storage systems, allowing developers to focus on their application logic rather than storage implementation details.

Pros

  • Supports multiple storage backends (local filesystem, Amazon S3, Azure Blob Storage, etc.)
  • Provides a consistent API for file operations across different storage systems
  • Simplifies file upload handling and management in PHP applications
  • Offers easy integration with popular PHP frameworks like Laravel

Cons

  • Limited documentation and examples available
  • May have a learning curve for developers new to the concept of abstract file systems
  • Potential performance overhead due to abstraction layer
  • Dependency on third-party packages for certain storage backends

Code Examples

  1. Creating a file instance:
use Uniform\File;

$file = new File('/path/to/file.txt');
  1. Uploading a file to a storage backend:
use Uniform\Storage\LocalFilesystem;

$storage = new LocalFilesystem('/path/to/uploads');
$file->upload($storage, 'new-filename.txt');
  1. Reading file contents:
$contents = $file->getContents();
echo $contents;
  1. Deleting a file:
$file->delete();

Getting Started

To start using Uniform in your PHP project:

  1. Install the library using Composer:
composer require audithsoftworks/uniform
  1. Create a storage instance for your desired backend:
use Uniform\Storage\LocalFilesystem;

$storage = new LocalFilesystem('/path/to/uploads');
  1. Use the File class to handle file operations:
use Uniform\File;

$file = new File('/path/to/local/file.txt');
$file->upload($storage, 'uploaded-file.txt');

Competitor Comparisons

9,703

Eases the creation of beautiful and testable command line interfaces

Pros of Console

  • More mature and widely adopted project with extensive documentation
  • Part of the larger Symfony ecosystem, offering seamless integration with other components
  • Supports a wide range of features, including input/output abstraction and command autocompletion

Cons of Console

  • Larger footprint and potentially more complex for simple CLI applications
  • Steeper learning curve for developers new to Symfony components
  • May introduce unnecessary dependencies for projects not using other Symfony components

Code Comparison

Console example:

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class GreetCommand extends Command
{
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Hello, World!');
        return Command::SUCCESS;
    }
}

Uniform example:

use Uniform\Command;

class GreetCommand extends Command
{
    public function handle()
    {
        $this->line('Hello, World!');
    }
}

Both libraries provide a straightforward way to create CLI commands, but Console offers more built-in features and abstractions, while Uniform aims for simplicity and ease of use.

🍃 In short, it's like Tailwind CSS, but for the PHP command-line applications.

Pros of Termwind

  • More active development with recent updates and releases
  • Extensive documentation and examples for easier adoption
  • Broader feature set for terminal styling and output manipulation

Cons of Termwind

  • Larger package size and potentially higher resource usage
  • Steeper learning curve due to more complex API and features
  • May be overkill for simple terminal output tasks

Code Comparison

Termwind:

use function Termwind\{render};

render(<<<'HTML'
    <div class="px-1 bg-green-300">
        Hello <span class="font-bold">World!</span>
    </div>
HTML);

Uniform:

use Uniform\Terminal as T;

echo T::green('Hello ') . T::bold('World!');

Summary

Termwind offers a more comprehensive solution for terminal styling with HTML-like syntax, while Uniform provides a simpler, more lightweight approach. Termwind is better suited for complex terminal UIs, whereas Uniform is ideal for basic color and formatting needs. The choice between the two depends on the project's requirements and the developer's preference for simplicity versus feature richness.

Provides mechanisms for walking through any arbitrary PHP variable

Pros of var-dumper

  • More comprehensive and feature-rich debugging tool
  • Part of the widely-used Symfony ecosystem, ensuring better support and integration
  • Offers advanced formatting options and customizable output

Cons of var-dumper

  • Larger footprint and potentially more complex to set up
  • May be overkill for simpler projects or lightweight debugging needs

Code Comparison

Uniform:

use Uniform\Debug;

Debug::dump($variable);

var-dumper:

use Symfony\Component\VarDumper\VarDumper;

VarDumper::dump($variable);

Key Differences

  • Uniform focuses on simplicity and ease of use, while var-dumper offers more advanced features
  • var-dumper provides better support for complex data structures and objects
  • Uniform has a smaller footprint and is more suitable for quick debugging tasks

Use Cases

  • Choose Uniform for lightweight projects or when simplicity is a priority
  • Opt for var-dumper in larger Symfony-based applications or when advanced debugging features are required

Community and Maintenance

  • var-dumper benefits from the large Symfony community and regular updates
  • Uniform has a smaller user base but may be more responsive to specific feature requests

Performance

  • Uniform generally has a lower performance impact due to its simplicity
  • var-dumper may have a slightly higher overhead but offers more comprehensive debugging capabilities

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

(jQuery) Uniform

A jQuery plugin to make your form controls look how you want them to. Now with HTML-5 attributes!

Works well with jQuery 1.6+, but we've received patches and heard that this works with jQuery 1.3.

Version 4.3.x uses jQuery 3.3.1+ and so far, things look promising.

NPM Total Downloads Contributors License

Installation

Packaging of Uniform comes with source SASS files and minified CSS files, ready for consumption in live/production environment. You can install Uniform via one of two methods listed below:

Via NPM

NPM Monthly Downloads NPM Total Downloads

Simply run:

npm install --save @imanov/jquery.uniform

To create minified file, run (though this isn't necessary, as the minified file is already included in the package):

npm run build

Minified source file will be built inside dist/ folder.

Via Public CDN

CDNJS jsDelivr Hits

Un-minified CSS files

For your own development purposes, to get human-readable, un-minified CSS outputs, you will need to install Uniform via NPM (as shown above), install the necessary dependencies through npm install and then run gulp. Doing so will recreate readable CSS files in dist/css folder. Invoking gulp --production however, will recreate minified CSS files (which is default behavior, what we already have in the dist folder).

Implementation

There are two ways to go with this:

Basic Implementation

Basically, you can use the final assets provided in dist folder out of the box.

Stylesheets and Javascript files should be linked in the <header> of your markup (the latter, coming after jQuery):

<!-- Make sure your CSS file is listed before Javascript sources -->
<link rel="stylesheet" href="/path-to-my-assets/uniform/dist/css/default.css" media="screen">
<script src="/path-to-my-assets/jquery/dist/jquery.min.js"></script>
<script src="/path-to-my-assets/uniform/dist/js/jquery.uniform.standalone.js"></script>

Or if you are using our bundled version - jquery.uniform.bundled.js file - which already comes with jQuery (beware not to include jQuery twice):

<!-- Make sure your CSS file is listed before Javascript sources -->
<link rel="stylesheet" href="/path-to-my-assets/uniform/dist/css/default.css" media="screen">
<script src="/path-to-my-assets/uniform/dist/js/jquery.uniform.bundled.js"></script>

Advanced Implementation

To have more control over your web assets, you can directly work with our SCSS and JS files, by importing them into or bundling with your own assets. Please be advised that our Gulp configuration (via Laravel-Elixir package) includes Auto-prefixer, i.e. browser prefixes are automatically added to CSS during the post-processing of SCSS files. Whatever your post-processing solution will be (Gulp-based or Compass), you need to make sure to include Auto-prefixer in that workflow. Our SCSS source files do not include browser prefixes out of the box!

Usage

See our Wiki page for documentation.

Reporting Bugs

It sure would be handy if you could create a test page to help illustrate bugs. When you use the GitHub Issue Tracker, you could use this jsfiddle to help illustrate your point. Additionally, we have provided some demo pages in /demo folder for you to use.

Even if you don't use these assets, all sorts of feedback is welcome, but narrowing down your problem or providing an example would immediately help narrow down the problem quickly.

Contributor/Developer Assets

We have created a Docker container to help our contributors with development of Uniform.

Additionally, /dev folder contains following assets, to further enhance our capabilities:

  1. docker folder contains necessary Dockerfile to build the container.
  2. theme-kit contains assets to help you create new themes.
  3. build.sh script, which basically spins a Docker container up and builds the package, using that instance.