Skip to content

feat: new documentation schema #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: v1.3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Deploy GitHub Pages

on:
push:
branches:
- v1.3.x
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build Project Documentation
runs-on: ubuntu-24.04
steps:
- name: Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

#####################################
# Generate Docusaurus documentation #
#####################################
- name: Install Pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
run_install: false
package_json_file: docs/package.json

- name: Install Node.js
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: '22'
cache: 'pnpm'
cache-dependency-path: 'docs/pnpm-lock.yaml'

- name: Install dependencies
working-directory: docs
run: pnpm install --frozen-lockfile

- name: Build Docusaurus documentation
env:
DOCS_ENV: production
working-directory: docs
run: pnpm run build --out-dir=../build

# Generate Doctum documentation
- name: build doctum docs
uses: sudo-bot/action-doctum@v5
env:
DOCS_ENV: production
with:
config-file: doctum-config.php
method: 'update'
cli-args: '--output-format=github --no-ansi --no-progress -v'

- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
name: github-pages
path: build

deploy:
name: Deploy to GitHub Pages
needs: [build]
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy uploaded artifact
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ cassandra.log
/**/.idea/
php-old/
target/
docker/scylladb/certs/
docker/scylladb/certs/
.cache
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# build docs

ENV ?= local

# Build the docs for the specified environment
.PHONY: docs-build
docs-build: docs-clean
@echo "Building docs for $(ENV) environment..."
cd docs && DOCS_ENV=$(ENV) pnpm build --out-dir=../build
DOCS_ENV=$(ENV) ./doctum update doctum-config.php
@echo "Docs built successfully for $(ENV) environment."

# Clean the docs build directory
.PHONY: docs-clean
docs-clean:
@echo "Cleaning previous docs build..."
rm -rf build
@echo "Cleaned previous docs build."

# Start Docusaurus in development mode with HMR
.PHONY: docs-docusaurus
docs-docusaurus: docs-clean
@echo "Building docs..."
cd docs && DOCS_ENV=$(ENV) pnpm start

# Serve the built docs from Doctum and Docusaurus (after building)
.PHONY: docs-serve
docs-serve: docs-build
@echo "Serving docs..."
cd build && php -S 0.0.0.0:8000
@echo "Docs served successfully."
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
85 changes: 0 additions & 85 deletions docs/Cassandra/SSLOptions/Builder.php

This file was deleted.

45 changes: 40 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
# Extension classes stubs
# Website

This directory exists to document classes defined by the `cassandra.so` and
`cassandra.dll` extension in plain PHP. None of the method bodies are actually
provided, but the interfaces and documentation should be complete and match what
is exposed in the extension.
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
5 changes: 5 additions & 0 deletions docs/docs/getting-started/cluster-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 3
---

# Configuring Cluster
36 changes: 36 additions & 0 deletions docs/docs/getting-started/data-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
sidebar_position: 4
---

# Data Types

The PHP driver provides a set of classes to represent the various data types that are supported by Cassandra. The following table lists the Cassandra data types and their corresponding PHP classes.

Here's the list of Cassandra data types and their corresponding PHP classes:

| Scylla/Cassandra Type | PHP Stub |
|-------------------------|---------------------------|
| Boolean | `bool` (native) |
| Tinyint | `Cassandra\Tinyint` |
| Smallint | `Cassandra\Smallint` |
| Int | `int` (native) |
| BigInt | `Cassandra\Bigint` |
| Float | `Cassandra\Float` |
| Double | `float` (native) |
| Ascii, Text, Varchar | `string` (native) |
| Counter | Not implemented |
| Blob | `Cassandra\Blob` |
| Inet | `Cassandra\Inet` |
| Uuid | `Cassandra\Uuid` |
| Timeuuid | `Cassandra\Timeuuid` |
| Date | `Cassandra\Date` |
| Time | `Cassandra\Time` |
| Timestamp | `Cassandra\Timestamp` |
| Duration | `Cassandra\Duration` |
| Decimal | `Cassandra\Decimal` |
| Varint | `Cassandra\Varint` |
| List | `Cassandra\Collection` |
| Set | `Cassandra\Set` |
| Map | `Cassandra\Map` |
| Tuple | `Cassandra\Tuple` |
| UDT (User defined type) | `Cassandra\UserTypeValue` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 81 additions & 0 deletions docs/docs/getting-started/installing-driver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
sidebar_position: 1
---

# Installing the Driver

Before creating your applications with ScyllaDB PHP Driver, make sure that your local machine has any PHP supported
version for the driver and [PIE (PHP Installer Extension)](https://github.com/php/pie), since we can install the driver
directly from there.

So, make sure you have the following prerequisites installed:

- Compilers: GCC 13.0+, Clang 16+ and c++23
- PHP: 8.1+
- Libraries:
- [libUV](https://www.php.net/downloads)
- [libscylladb](https://www.php.net/downloads)

## Installing the Prerequisites

### Installing LibUV

To install libUV, you can use the following commands based on your Linux Distro:

```bash
# Debian/Ubuntu
sudo apt install libuv1-dev

# Archlinux
sudo pacman -S libuv

# Fedora
sudo dnf install libuv-devel

# CentOS/RHEL
sudo dnf install epel-release
sudo dnf install libuv-devel
```

or if you prefer, you can build directly from source:

```bash
git clone --depth 1 -b v1.46.0 https://github.com/libuv/libuv.git \
&& cd libuv \
&& mkdir build \
&& cd build \
&& cmake -DBUILD_TESTING=OFF -DBUILD_BENCHMARKS=OFF -DLIBUV_BUILD_SHARED=ON CMAKE_C_FLAGS="-fPIC" -DCMAKE_BUILD_TYPE="RelWithInfo" -G Ninja .. \
&& ninja install
```

### Installing LibScyllaDB

To install libScyllaDB you will need to get directly from the GitHub Repository since we need the latest version:

```bash
git clone --depth 1 https://github.com/scylladb/cpp-driver.git scyladb-driver \
&& cd scyladb-driver \
&& mkdir build \
&& cd build \
&& cmake -DCASS_CPP_STANDARD=17 -DCASS_BUILD_STATIC=ON -DCASS_BUILD_SHARED=ON -DCASS_USE_STD_ATOMIC=ON -DCASS_USE_TIMERFD=ON -DCASS_USE_LIBSSH2=ON -DCASS_USE_ZLIB=ON CMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC -Wno-error=redundant-move" -DCMAKE_BUILD_TYPE="RelWithInfo" -G Ninja .. \
&& ninja install
```

After that, move the binary to your system path and we're ready to install the driver!

## Installing the Driver

To install the driver, you should use [PIE](https://github.com/php/pie) to install it directly from the PHP repository:

```bash
pie install codelieutenant/scylla-driver
```

With that, you probably can check at your PHP Info if the driver is installed correctly.

:::warning

If you're not running as a sudoer, you will have to manually enable the extension in your `php.ini` file manually.

![PHP Info](./img/pie-install-warning.png)

Loading
Loading