Download the PHP package bakame/shoe-size-converter without Composer

On this page you can find all versions of the php package bakame/shoe-size-converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package shoe-size-converter

Bakame Shoe Sizes Converter

This small application was prompted by the following post https://phpc.social/@[email protected]/117123893682362282

Converting shoes size is difficult, too difficult!!

Too many standards

I discovered schuhgroessen-umrechner and, inspired by Sarah's excellent work, built this small library as an independent reimplementation.

System Requirements

[!IMPORTANT] If the conversion data is stored in a CSV file you will have to install league/csv >= 9.28

If the conversion data is stored in a database, ext-pdo support is required.

Installation

Shoe size converter is available on Packagist and can be installed using Composer:

composer require bakame/shoe-size-converter

The SPA

The original script by Sarah Amft has been reimplemented using this library's API and is available in the public directory. It provides a small single-page application for converting adult and children's shoe sizes between supported shoe size systems.

To run the converter locally:

`

Then open http://localhost:4000/ in your browser.

The application allows you to convert both adult and children's shoe sizes.

The CLI command

The package also provides a command-line converter.

To run the CLI command locally:

This returns:

The first argument is the input shoe size unit, followed by the shoe size value. For example:

You can specify the shoe size system using the --type or -t option. The supported values are adults and children. The adults system is used by default when no type is explicitly specified.

Option Description Default
--type, -t Shoe size system: adults or children adults

The Library

Create a shoe size using one of the supported units:

Both instances expose their numeric value and unit:

[!IMPORTANT] Adult and children's shoe sizes differ in how their conversions are determined. Adult shoe sizes can be converted using deterministic foot-length-based formulas, whereas children's shoe sizes MUST use a specific conversion table.

Adult shoe size conversions

Calculated conversions

AdultSize supports deterministic shoe-size calculations based on foot length. You can calculate an equivalent shoe size in any supported adult unit using AdultSize::in():

The calculated value is the nearest size supported by the target sizing system. It is not a lookup in the ISO conversion table.

You can also calculate all supported adult equivalents at once with AdultSize::equivalents():

These calculation methods are only available for AdultSize. Children's shoe sizes cannot be calculated using foot-length-based formulas and therefore must be converted using the conversion table.

Physical measurements

An AdultSize can also be represented by its physical foot measurement via its dedicated $footLength property, expressed as a Bakame\Shoes\Length. The Length class allows converting the length to millimeters, centimeters, or inches:

These measurements are calculated from the shoe size's foot length and are independent of the conversion lookup table.

Adult shoe sizes can be compared by their physical foot length using Length::compare(). This compares the underlying measurement, regardless of the shoe-size system or length unit:

The comparison returns a negative value when the first shoe is shorter, 0 when both shoes have the same foot length, and a positive value when the first shoe is longer.

For children's shoe sizes, where a foot-length calculation cannot be used, Converter::footLength() retrieves the corresponding measurement from the conversion table:

Converter can also be used for adult shoe sizes. When an adult size or measurement is not available in the conversion table, Converter falls back to the corresponding calculation.

This means that Converter::size() and Converter::footLength() can be used with both adult and children's shoe sizes while preserving the appropriate conversion strategy for each system.

ISO 19407:2023-based conversions

If you want to use the provided conversion data, use Converter.

Converter::size() and Converter::equivalents() use the configured conversion table and fall back to the calculation algorithm when converting an AdultSize if the required data is not available. For ChildSize, the conversion table is the only source of conversion data.

These methods can be used for both adult and children's shoe sizes, provided that the Converter is configured with the corresponding ShoeType.

For example:

Or retrieve all available equivalents:

If no equivalent is present in the conversion table, Converter falls back to the calculation algorithm for AdultSize. For ChildSize, no equivalent can be calculated, so null is returned when no matching entry is found.

Adult Children
AdultSize::footLength Calculation Not available
AdultSize::in() Calculation Not available
AdultSize::equivalents() Calculation Not available
Converter::footLength() Table, then calculation Table only
Converter::size() Table, then calculation Table only
Converter::equivalents() Table, then calculation Table only

Persistence Layer

The converter can be created using one of the following data sources:

When a file path or stream is provided, it must reference a valid CSV file with the expected structure for the selected ShoeType. When a PDO connection is provided, the database must contain the appropriate conversion table with the expected columns for the selected ShoeType.

The expected structure depends on the shoe size system:

For CSV sources, these names must be provided as the column headers in the first row. For PDO sources, the data must be stored in the corresponding table:

Both tables must use the expected columns for their respective shoe size system.

Attribution

This library is an independent reimplementation inspired by schuhgroessen-umrechner by Sarah Amft.

The original project provided the reference for the shoe-size conversion functionality. The implementation, API, and examples have been completely rewritten as a standalone library.

All credit for the original work and inspiration goes to Sarah Amft.

Contributing

Contributions are welcome and will be fully credited. Please see CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see LICENSE for more information.

Happy Coding!


All versions of shoe-size-converter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bakame/shoe-size-converter contains the following files

Loading the files please wait ...