承接 bogdaan/spycss 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bogdaan/spycss

Composer 安装命令:

composer require bogdaan/spycss

包简介

Analyze user interactions via CSS, without JavaScript

README 文档

README

Build Status

Analyze user interactions via CSS, without JavaScript on client-side. Demo at spycss.hcbogdan.com.

  • Why?
  • Because we can

How it works

As you probably know, in css we can add external resources via url(resource) property. Usually, this resource is only loaded when its needed. So, we can create HTML/CSS that will track user interactions, and send request to our backend.

This library was created in order to simplify the creation of tracking css.

How to use

First, install library with composer:

composer require bogdaan/spycss

For example, you want to track click on some link. We can use this snippet to generates CSS and HTML for you link inside view:

<?php
// inside controller or DI:
$userId = 'get_from_cookie--OR--fetch_from_db';
$backendUrl = 'https://spy-css-backend/';
$s = new \SpyCss\SpyCss($userId, $backendUrl);

// inside you view, generates element:
// <a class="scsssXXXX" href="https://hcbogdan.com">Novikov Bogdan</a>
echo $s->builder()
    ->tag('a')
    ->content('Novikov Bogdan')
    ->attribute('href', 'https://hcbogdan.com')
    ->interactions([
        new \SpyCss\Interaction\Active('click_on_hcbogdan_com')
    ])
    ->get();

// generates special styles like:
// .scsssXXXX:active::after {content: url(https://spy-css-backend/userId/active/click_on_hcbogdan_com);}'
echo '<style>'.$s->extractStyles().'</style>';

You can create keylogger for input type="text" fields (snippet at jsfiddle):

<?php
// ... init SpyCss

// set alphabet
$logThisChars = 'abcdefgABCDEFG';

// create input field
echo $s->builder()
    ->tag('input')
    ->attribute('name', 'field')
    ->interactions([
        new \SpyCss\Interaction\Keylogger($logThisChars)
    ])
    ->get();

// generates special styles
echo '<style>'.$s->extractStyles().'</style>';

See more examples at spycss-demo

Directory structure

./src/
├── Builder.php          # Tag builder with fluent interface
├── Interaction          #
│   ├── Active.php       # Track :active state
│   ├── Checked.php      # Track :checked state on input and option
│   ├── Focus.php        # Track :focus state
│   ├── Hover.php        # Track :hover state
│   ├── Keylogger.php    # Track key press on text fields
│   ├── Online.php       # Online tracking
│   ├── Pseudo.php       #
│   └── Valid.php        # Track :valid state
├── Interaction.php      # Base class for interactions
├── SpyCss.php           #
└── Util                 #
    └── Html.php         # Html tag helpers

Todo

  • Review browser support
  • Update demo
  • Add more interactions
  • Implement twig helper

Read more

Contributing

Pull request are welcome.

Inspired by jbtronics/CrookedStyleSheets.

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 42
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 42
  • Watchers: 5
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固