Download the PHP package rugaard/weatherkit without Composer

On this page you can find all versions of the php package rugaard/weatherkit. 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 weatherkit

Banner PHP 8.1 Coding style Tests Coverage License

⚠️ DISCLAIMER ⚠️

Apple's WeatherKit REST API is currently still in beta and the documentation is not fully up-to-date.

During development undocumented responses and values were encountered, but have been handled to the best of what information was available at the time.

📖 Table of contents

🚀 Features

🔹 = In countries where available. 🔸 = When a country code is provided.

📦 Installation

You can install the package via Composer, by using the following command:

Laravel provider

This package comes with a out-of-the-box Service Provider for the Laravel framework. If you're using a newer version of Laravel (>= 5.5) then the service provider will loaded automatically.

Are you using an older version, then you need to manually add the service provider to the config/app.php file:

Configuration

The default package configuration are setup to use the following environment variables.

Variable name Default Description
RUGAARD_WEATHERKIT_AUTH_FILEPATH Path to the .p8 key file.
RUGAARD_WEATHERKIT_AUTH_KEY_ID Key ID matching the .p8 key file
RUGAARD_WEATHERKIT_AUTH_APP_PREFIX_ID App Prefix ID (aka. Team ID)
RUGAARD_WEATHERKIT_AUTH_BUNDLE_ID Bundle ID of your App ID.
RUGAARD_WEATHERKIT_LANGUAGE_CODE config('app.locale', 'en') Language code
RUGAARD_WEATHERKIT_TIMEZONE config('app.timezone', 'UTC') Set timezone of timestamps

Should you need to change the default configuration, you can publish the configuration file to your project.

🔑 Authentication

After Apple bought DarkSky and turned into WeatherKit, the API now requires authentication. To be able to authenticate, you are required to be part of Apple's Developer Program.

Once you're enrolled with Apple Developer Program, you must register a new App ID and create a new Key.

Create new App ID

To create a new App ID, you must register your app on this form. Enter a short description and give your app a unique bundle ID (reverse url).

Example: Description Bundle ID
Latest weather forecast com.forecast.weather

When you are done filling out the required fields, you need ☑️ WeatherKit under the Capabilities and App Services tabs.

Afterwards, click the blue Continue button and you're done.

Create new key

To create a new key, you must generate it from this form.

Give your key a name and make sure to enable ☑️ WeatherKit. When you're done, click the blue Continue button. You'll be redirected to a confirmation page, where you click the blue Register button.

Then, download your key as physical file to your machine. It's required for authenticating with the API.

And that's it. You're done.

⚙️ Usage

Before the client can be instantiated, it requires an access token. To generate an access token, Apple requires you to create an App ID and Key, which you to download as a physical file.

If you have not done these things yet, you can follow the guide in the 🔑 Authentication section of this README.

Generate access token

To generate an access token, you're going to need a few things:

When a Token instance has been created, you can retrieve the generated access token in two different ways.

Standalone

Before we are able to make any requests to the API, we need to instantiate the HTTP client. A client can be instantiated with or without a default location.

When a client has been instantiated, it's possible to change the location, language and timezone, if needed.

You can either retrieve all forecasts at once or individually.

When a country code has been set with the client, you are able to retrieve weather alerts, should there be any associated with the location.

With Laravel

When using this package with Laravel, the client will automatically be instantiated and added to the service container.

By default the settings are set via environment variables, described in the 📦 Installation section. Should you want to use something else than environment variables, you can change it in the config file at config/weatherkit.php.

It's possible to set/change default settings on the Client by setting them in the boot() method of the AppServiceProvider. This way, you can avoid setting location/language/timezone on each request.

📚 Documentation

For more in-depth documentation about forecast types, measurements and more, please refer to the Wiki.

🚓 License

This package is licensed under MIT.

Since this package uses an Apple service, you need follow the guidelines and requirements for attributing Apple weather data. For more details, view the attribution requirements on Apple's website.


All versions of weatherkit with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
ext-openssl Version *
guzzlehttp/guzzle Version ^7.0
illuminate/collections Version ^9.26 || ^10.14
firebase/php-jwt Version ^6.3.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 rugaard/weatherkit contains the following files

Loading the files please wait ....