Download the PHP package spresnac/laravel-tactical-time-helper without Composer

On this page you can find all versions of the php package spresnac/laravel-tactical-time-helper. 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 laravel-tactical-time-helper

laravel-tactical-time-helper

About

This helper package provides you some aiding when it comes to deal with tactical times on your input and output side. I do need this package in my Red-Cross related projects, so they are already battle-tested 🫡.

It is not feature-complete so you are welcome to add your code 🙏


Install

First things first, you install this package with


Usage

This package contains 2 parts to help you with your times.

Form request rules

The form request rules provide some guiding about handling incoming form fields where tactical data should be provided by the user. Therefor you can use the TacticalTime class in the Rules directory. An example; in your requests class, you can write it like so:

By default, the TacticalTime rule wants to have the input like 082145may2024 while it ignores the cases. It ignores the case to prevent beeing to strict (there are humans on the other side and mostly, this humans do not have much time when it comes to tactical time inputs) and on the other side the case is not relevant when it comes to converting the input to the real time you store in your database (or whereever); in short: Carbon can handle it, no matter the case 😉


Repository Helper

The TacticalTimeRepository provides you 2 static helper functions

public static function toTacticalTime(Carbon $time): string

This function takes a Carbon input and converts it to the corresponding tactical time. Using Carbon is pretty neat in laravel projects because most of your date-related things are (or should be) in Carbon (like created_at or updated_at or in my case a situation_at).
In short: As long as your input is Carbon you are good to go.

public static function fromTacticalTime(string $tactime): Carbon

This function takes a string and converts it to it's corresponding Carbon object (so you can easily store it into databases or whereever you persist your data).
The input MUST be like 082145may2024, so 2 digits for the day, 2 digits for the hour, 2 digits for the minutes, the month as 3-letter-short and the year with 4 digits.
The result is a Carbon object to work further with.


Test

You can test this package by installing it with all dependencies

and then run

(depending on your OS you have to add .\ in front of the line)


All versions of laravel-tactical-time-helper with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
nesbot/carbon Version ^2|^3
illuminate/contracts Version ^11
illuminate/translation Version ^11
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 spresnac/laravel-tactical-time-helper contains the following files

Loading the files please wait ....